(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Control of an RG2 / RG6 Gripper using the Modbus / TCP protocol (ROS Noetic)

Description: This tutorial explains how to use the "onrobot_rg_control" and "onrobot_rg_modbus_tcp" packages to control an RG2 / RG6 Gripper configured with the Modbus / TCP protocol.

Tutorial Level: BEGINNER


This tutorial assumes that you have an RG2 / RG6 Gripper configured with the Modbus / TCP protocol. The Gripper should be connected to a network, which has been properly configured.

Finally, make sure that the external dependency for the package "onrobot_rg_modbus_tcp" has been installed. The dependency is the python package pymodbus.

$ rosdep install onrobot_rg_modbus_tcp

Network configuration

Make sure that the ethernet card in your PC to which your gripper is connected has the following static IP network configuration:


The static IP address of the PC ( can be any IP address different from the hand's IP address (whose default is

ROS Nodes to Control the RG Gripper

Run the RG Gripper Driver Node

The Gripper is driven by the node "OnRobotRGTcpNode.py" contained in the package "onrobot_rg_control". The IP address of the Gripper has to be provided as an argument.

For example, the driver for controlling an RG2 /RG6 Gripper with the IP address is launched using the following command:

$ roslaunch onrobot_rg_control bringup.launch ip:=

Run the RG Gripper Status Listener Node

In the package "onrobot_rg_control", there is also a node for listening to and interpreting the status of the Gripper. The driver publishes the status of the Gripper on "OnRobotRGInput". The status listener node can be run together with the driver node using the following same command:

$ roslaunch onrobot_rg_control bringup.launch ip:=


Run the RG Gripper Simple Controller Node

The driver listens for messages on "OnRobotRGOutput". The messages are interpreted and commands are sent to the gripper accordingly. A simple controller node is provided which can be run (at another terminal) using:

$ rosrun onrobot_rg_control OnRobotRGSimpleController.py


The simple controller node can therefore be modified to send custom commands to the Gripper.

Wiki: onrobot/Tutorials/Control of a RG gripper using the Modbus TCP protocol (Noetic) (last edited 2022-02-24 13:19:38 by TakuyaKiyokawa)