Remote control of a Robotiq Gripper connected to the UR5 via USB
/ Most recent by Huweiwen
Currently, we are trying to control the Robotiq Gripper which is connected via USB to a UR5 remotely using the Universal_Robots_ROS2_Driver but couldn’t manage to do so. Regarding this topic, we would appreciate some instructions.
PC OS: Ubuntu 20.4
ROS Distribution: Foxy
UR model: UR5
What we tried
Apart from using the ROS2 driver, we tried using the URX library. The approach of this library is to connect via a TCP socket on port 30002 and send a URScript that controls the gripper. This was successful. But if we run the ROS2 driver and send a trajectory to the UR5n and start controlling the gripper using the URX library, the driver loses connection. This gets printed in the consol where the driver runs:
[ros2_control_node-1] [INFO] [1638961383.669717614] [UR_Client_Library]: Connection to reverse interface dropped.
In order to make sure, there is nothing else happening in the URX library that distracts the ROS2 driver, we extracted a minimal example in python on how the gripper is controlled:
from time import sleep
HOST = "192.168.1.102"
SEC_PORT = 50002
i_sec = socket.create_connection((HOST, SEC_PORT), timeout=0.5)
with open('gripper_close.txt') as f:
close_program = f.read()
And this is the URScript that is loaded from 'gripper_close.txt' (the code between myProg and end should be indented):
Still with this minimal version, the ROS2 driver loses connection, when we run this example when sending a trajectory through the ros interface.
We haven't tried that yet but we are also thinking about forwarding the port of the grippe (63352), so we can access it remotely.
What we understand so far
There are different ports used for communicating with the UR:
50002: primary interface, remote computer sends URScript to the UR that is interpreted by the URCap, 125Hz
50001: UR requests the the remote computer to send URScript
30003: UR sends the current status of the robot in real-time
30002: secondary interface, remote computer sends URScript that contains commands that are not interfering with commands from the primary interface, 10Hz
54321: port of the tool communication interface for a remote computer to use tools connected to the UR?, not available for the UR5 but for UR5e?
Is this interpretation correct? Is there anything else happening on these ports that is important for our problem?
We searched in the ROS2 driver repository for more clues on why using port 30002 from another program interferes with the ROS2 driver but we couldn't find a clue. Maybe we missed something.
Ideally, we would like to use a controller with a topic where we can publish control messages for the Robotiq gripper.
Is this possible or are there any other workarounds to achieve remote control of the gripper?
We would much appreciate some tips and explanations.