There is a sensor/scanner at the end of the robot. The goal is to move to a target, have the sensor take a measurement, move to another target, and so on.
To control the sensor, a Python script will make a socket connection to the IP address and port number of the sensor. This all works when there is one Python script that makes the connection, sends commands, and the closes the connection at the end.
My question is how to handle this in the context of robot instructions inside RoboDK. From a RDK point of view I have the structure shown below:
There is an initialize script that creates the socket connection and sets parameters in the sensor. Then a script that tells the sensor to take a measurement - called after each robot movement.
Here is the question - as soon as the initialize script ends the socket connection is destroyed. So every time the robot moves and needs to take a measurement a script has to establish a new connection. Of course, that is also destroyed after that script ends. How can I accomplish a procedure like this (move - measure - move) and keep the socket connection alive?
Thanks for your help.
To control the sensor, a Python script will make a socket connection to the IP address and port number of the sensor. This all works when there is one Python script that makes the connection, sends commands, and the closes the connection at the end.
My question is how to handle this in the context of robot instructions inside RoboDK. From a RDK point of view I have the structure shown below:
There is an initialize script that creates the socket connection and sets parameters in the sensor. Then a script that tells the sensor to take a measurement - called after each robot movement.
Here is the question - as soon as the initialize script ends the socket connection is destroyed. So every time the robot moves and needs to take a measurement a script has to establish a new connection. Of course, that is also destroyed after that script ends. How can I accomplish a procedure like this (move - measure - move) and keep the socket connection alive?
Thanks for your help.