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