Interrupting motion based on socket data
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!
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!
0
Comments
-
HiYou can create a backround task which will use socket for communicating with the Java application. This backround task feature needs a RobotWare option called Multitasking. You can read more about it from Rapid overview manual (section 1.20 Multitasking).The definition of the backround task (as well as the I/O signals you will need) are made in the system parameters. There is a manual for the system parameters, it's called Technical reference manual - System parameters. Parameters related to Multitasking are found under the topic Controller->Type Task. Take a look also the Type Automatic loading of modules under the Controller topic.For I/O:s see the types Unit and Signal under the topic I/O. I suggest to create a virtual I/O unit with one virtual output signal, which you can use in your Rapid program. You can set the signal in the backround task and then you can wait for the output in the main task using WaitDO (instead of WaitDI).I hope this brief info will help you.-Osku0
-
Thank you for the useful information and references! I'll read up on the things you mentioned and see if I can get it to work.
0 -
So I was able to follow most of the documentation you pointed me to, but upon trying to define the digital output signal to use with the trap, I ran into a problem. You mentioned in your response that I should define a virtual unit with one virtual signal, but from the documentation it seems that to make a signal virtual, it should not be assigned to any specific unit. As a result, it seems that I would not have to define a virtual unit at all. Is this correct, or am I not understanding the documentation correctly?
0 -
Yes, you are right. It's not necessary to define a unit for the virtual signal. It works both ways.-Osku0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 801 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings