# set inputs of UR5 from ur_modern_driver

Hello community,

is it possible to set Inputs of the UR5 trough ROS by using the ur_modern_driver package? We want to read those inputs on the UR5 and by reading it in the script-program..

Michael

--------EDIT:----------------

We are running a URScript on the TeachPendant (version 5.1.2.40245). So the ROS-PC running ur_moder_driver (0.1.0 kinetic devel) connected over ethernet to URcontrol PC (of our UR5e series) should set something to be able to communicate with the UR-Script running from the Teach Pendant. Is that even possible?

The get_flag function is not chooseable from the dropdown menue but can be used when typing manually on Polyscope. We are constantly checking the status of flag 1 but see no changes when calling:

rosservice call /ur_driver/set_io
"fun: 2 pin: 1 state: 1"


we get

success: True


but on the teach pendant the LOG dialogue shows: RTMachine: socket_get_var: socket error

However, it would seem that the setter for flags was missed and still tries to use a regular statement (here). That will most likely collide with a running program (but I'm not sure). You may want to try and change URCommander::setFlag(..) to also use a secondary program.

Edit 2:

We were seeking arround for a workarround: We are now setting outputs that can be wired to inputs of the UR5 controller (physically) and were successful with runing following script:

import socket
HOST = "192.168.131.10"  # The remote host
PORT = 30001 # The same port as used by the server

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
cmd = "set_digital_out(2,True)" + "\n"
#cmd = "set_digital_out(2,False)" + "\n"
s.send (cmd.encode('utf-8'))
data = s.recv(1024)
s.close()


I know that this solution is a bit dirty but works for us in the meantime. Nevertheless we would be happy to contribute to the solution to be able to communicate over flags.

The surrounding code (for analogue IOs fi) should be usable as a template. See the link to the code that sets the analogue out I linked earlier fi (here).

Which surounding do you mean? What do you mean with analogue IOs fi?

Thank you so much!

edit retag close merge delete

Sort by » oldest newest most voted

No, not the inputs afaik.

But you can set flags. Which you should be able to use in your URScript program in the same way.

See ur_msgs/SetIO for some comments on the SetIO service and its fields.

Edit:

We are running a URScript on the TeachPendant. So the ROS-PC connected over ethernet to URcontrol PC should set something to be able to communicate with the UR-Script running from the Teach Pendant. Is that even possible?

Using the SetIO service that should be possible, yes. ur_modern_driver uses secondary programs to set tool voltage and digital and analogue outs (here fi for analogue outs). Secondary programs don't interfere with the program already running on the controller.

However, it would seem that the setter for flags was missed and still tries to use a regular statement (here). That will most likely collide with a running program (but I'm not sure).

(Mini-edit: tracking this in ros-industrial/ur_modern_driver#343)

You may want to try and change URCommander::setFlag(..) to also use a secondary program.

That may still not work, but would be something I would suggest you try.

And for future edits: please include requested output, commands and version information. Right now I'm guessing as to what you're actually doing, which controller series this is, what version of Polyscope you are running and which version of ur_modern_driver you are using.

Edit 2:

However, it would seem that the setter for flags was missed and still tries to use a regular statement (here). That will most likely collide with a running program (but I'm not sure). You may want to try and change URCommander::setFlag(..) to also use a secondary program.

How would you do that?

The surrounding code (for analogue IOs fi) should be usable as a template. See the link to the code that sets the analogue out I linked earlier fi (here).

more

Hy, unfortunately also setting flags does set any inputs on the ur controller, also if i set to "remote control". (I checked this by wathing the "I/O" dialogue. On the LOG dialogue always the same warning appears that they are only allowed to read.) Are´nt there other possibilities? I really dont want to use a wired connection to the IO's.

( 2019-08-26 05:42:24 -0500 )edit

Flags should definitely be settable. See here for the 3.2 script manual and here for the 5.4 script manual (search for set_flag).

If you can show how you are trying to set the flags, we can deduce what is going wrong.

Please add the rosservice call command line that shows your problem to your original question (use the edit button/link for that).

Edit: I'm assuming you meant to write that "setting flags does not set any inputs".

Note: flags != digital inputs`. They are separate.

( 2019-08-26 06:00:31 -0500 )edit

If you cannot get this to work / make the modifications yourself, let me know. I may have some time this evening to put a PR together.

( 2019-08-27 05:50:29 -0500 )edit

we are currently trying to make it work, but if you have time that would be awesome....thank you!

( 2019-08-27 06:57:26 -0500 )edit

Then at least show what you have so far ..

( 2019-08-27 07:56:05 -0500 )edit