Hi everyone! I’m new to RobotStudio and RAPID, and I’ve been making progress on making some simple programs with the help of tutorials, manuals, etc. I have one idea I would like to implement, but before I dive into it, I wanted to make sure that my approach makes sense, and possibly get some hints or suggestions from seasoned RAPID users.
The idea is that I would like to have a socket connection between RAPID and a Java application running on another computer on my network. The Java application will perform some tasks and calculations, and send a signal to RAPID. The signal will tell the robot if it’s clear to continue, or if it should stop. If the robot is told to stop, it should be able to continue moving again once the signal sent from Java changes back to “go ahead”. Java will be sending the resulting signal (go or stop) several times per second, perhaps every 100ms.
From researching the RAPID reference manual, the forum, and some websites I found on google, the approach I am thinking of taking is to use a TRAP which will link to a digital input. The TRAP will use a StopMove command, then a WaitDI command to wait for the signal to switch back to “go ahead”. Then a StartMove will be called after that. The digial signal will be changed by information gathered from the socket connection with Java. I found some resources on how to set up sockets in RAPID, so I should be able to set that part up.
Here is where I get stuck - how do I continuously monitor the signal being sent from Java via the socket, even while a move command is being executed? Can I have a secondary process running in the background of my main program gathering information from a socket connection continuously? If so, how is this done?
Also, how does one define and assign a value to a digital input through RAPID code? It seems like a simple concept, but for some reason I cannot find this anywhere.
Thank you for any information/help/pointers in advance!