ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

set inputs of UR5 from ur_modern_driver

asked 2019-08-23 04:47:54 -0500

mtROS gravatar image

updated 2019-08-27 10:06:00 -0500

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..

Thanks for your help!

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()
print('Received', repr(data))

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 flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-08-23 08:04:49 -0500

gvdhoorn gravatar image

updated 2019-08-27 03:23:44 -0500

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).

edit flag offensive delete link more

Comments

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 don`t want to use a wired connection to the IO's.

mtROS gravatar image mtROS  ( 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.

gvdhoorn gravatar image gvdhoorn  ( 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.

gvdhoorn gravatar image gvdhoorn  ( 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!

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

Then at least show what you have so far ..

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

Question Tools

2 followers

Stats

Asked: 2019-08-23 04:47:54 -0500

Seen: 637 times

Last updated: Aug 27 '19