Skip to content

Sending urscript in remote control mode while UR_Driver running #982

@Sohaib-Snouber

Description

@Sohaib-Snouber

Affected ROS2 Driver version(s)

ROS2

Used ROS distribution.

Iron

Which combination of platform is the ROS driver running on.

Ubuntu Linux with realtime patch

How is the UR ROS2 Driver installed.

From binary packets

Which robot platform is the driver connected to.

UR E-series robot

Robot SW / URSim version(s)

polyscope

How is the ROS driver used.

Through the robot teach pendant using External Control URCap

Issue details

Summary

I have installed the ROS2 ur_driver and the URCaps and both running fine with testing them using the MoveIt, but i have only in rviz just the ur5e without the gripper, so i have read from an issue that it is not easy to configure the gripper in the ur_description and be able to control it, so i have chosen to use the urscript to be able to control the gripper, but till now i have only succeded to control the digital output and be able to move the robot using the urscript by running a python code as the following:

`import socket

def send_urscript(ip, port, script):
try:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((ip, port))
s.sendall(script.encode('utf-8'))
print("Command sent successfully.")
except Exception as e:
print(f"An error occurred: {e}")

robot_ip = '10.130.1.100' # Replace with your robot's IP
port = 30002 # Standard port for URScript commands

urscript_command = '''
def secondaryProgram():
set_digital_out(1, False)\n
sleep(5)\n
set_digital_out(1, True)\n
sleep(10)\n

end\n
secondaryProgram()
'''

send_urscript(robot_ip, port, urscript_command)

`
after running the ur_driver and running my urcaps external control, i also used the remote control to be able to send urscripts, but when i run the the python code i get what i have written in the code, but after that the urcaps external control will be stopped automatically alone, i have thought of primary and secondary programms and using the information of this site [https://www.universal-robots.com/articles/ur/interface-communication/remote-control-via-tcpip/] i did not get any other response using port like 30001, 30002 or 30003, the other ports did not work for remote control (I could not receive the true digital output by using 30004, 30011, etc).

Another problem is that i tried in this way to control the gripper (2F Adaptive gripper) that is connected to the wrist of the roboter with these type of commands e.x. "rq_open()" in urscript, but it didn't work (I have only activated the gripper from the teach pendant after i turned on the device).

One more thing that is maybe be important to say is that while running the ur_driver a two repeated message is shown that about 0.5 - 1 ms the connection to reverse interface dropped as shown

[ur_ros2_control_node-1] [INFO] [1714412116.518364831] [UR_Client_Library:]: Connection to reverse interface dropped.
[ur_ros2_control_node-1] [INFO] [1714412116.518765602] [UR_Client_Library:]: Robot connected to reverse interface. Ready to receive control commands.
[ur_ros2_control_node-1] [INFO] [1714412117.378185573] [UR_Client_Library:]: Connection to reverse interface dropped.
[ur_ros2_control_node-1] [INFO] [1714412117.378787896] [UR_Client_Library:]: Robot connected to reverse interface. Ready to receive control commands.

Finally when the python code is executed then the "connection to reverse interface dropped" message is only received.

Thanks for all your help and support.

Relevant log output

No response

Accept Public visibility

  • I agree to make this context public

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions