Discussion

Left ArrowBack to discussions page
VT_340VT_340 Posts: 17 Apprentice
Hi!

I would like to know how to get data (e.g a X/Y Variable position from a sensor outside the robot) via TCP into the robotic program?

In general this is described here:

http://www.zacobria.com/universal-robots-zacobria-forum-hints-tips-how-to/script-tcp-socket-test/

But I don't feel like to remake this huge program within the PolyScope GUI. Lets say for testing I just want to send a variable from my computer (e.g via Python) to the robot that I can check their value within the "Variables" tab. In a second step I want to make the robot move to positions given by the variables.

I was succsellful in sending complete move commands to the robot via Python but I want to use the advantage of the GUI which means easy programming but insert changes from the computer.

Thanks,


Hans

Best Answer

Comments

  • matthewd92matthewd92 Posts: 508Founding Pro, Tactile Sensor Beta Testers Handy
    edited April 20
    There are two ways to do it, set up a socket server or xmlrpc server on your computer. Then within URScript you would request a value and then assign the return to a variable. XMLrpc is definitely more performant than socket commands. Also it's only one command to ask and receive a value. With a socket server you'd have to request the value you want then listen for the return with a separate command. 

    If you need more specifics on how to implement let me know and I can setup a simple demo when I'm home tomorrow. 
  • matthewd92matthewd92 Posts: 508Founding Pro, Tactile Sensor Beta Testers Handy
    @louis_bergeron that's something I'll have to remember!  Thanks for the example
  • VT_340VT_340 Posts: 17 Apprentice
    Hi!
    Thanks Louis for your example script.
    So far I just sent the move command via TCP on Port 30002 and this works like charm. As I am not into Modbus I would rather use ordinary TCP socket. Another thing is: How can I get the code into Polyscope? I just can open .urp data.

    Thanks,

    Hans
  • matthewd92matthewd92 Posts: 508Founding Pro, Tactile Sensor Beta Testers Handy
    @VT_340 if you are running a polyscope program and then send a move command to that port your main program should stop running. You can only send secondary programs that do not control motion while a primary program is running.  You should test just making a simple polyscope program, start it and then send the move command, pretty certain it will stop as the server always processes the last program sent to the server. Same as if you sent a move and before that was done sent a different move. It would stop executing the first to execute the second prior to completing the first program. 
Sign In or Register to comment.
Left ArrowBack to discussions page