Important: This is a dependency: https://github.com/ian-chuang/serial-ros2
This repository contains a ROS2 driver for controlling the DH Robotics AG95 Gripper. It builds upon the low-level code from DH Robotics' ROS1 driver and integrates it with ros2_control, following the structure of ros2_robotiq_gripper.
Note: This driver has been tested on Ubuntu 22.04 and ROS2 Humble.
-
Source ROS2 Humble:
source /opt/ros/humble/setup.bash
-
Clone the repository into your ROS2 workspace:
cd /path/to/your_ros2_ws/src git clone -b humble https://github.com/ian-chuang/dh_ag95_gripper_ros2.git
-
Install dependencies using rosdep:
rosdep install -i --from-path . --rosdistro humble -y
-
Build the package:
colcon build
-
Source the setup files:
source /path/to/your_ros2_ws/install/local_setup.bash
-
Find the port that the gripper is currently binding to, e.g.,
ttyUSB0
. -
Run the following command to obtain the serial number:
udevadm info --name=/dev/ttyUSB0 --attribute-walk | grep serial
Use the first serial number that shows up; the format should look similar to
FT6S4DSP
. -
Edit the udev rules file:
sudo nano /etc/udev/rules.d/99-dh-ag95-gripper.rules
Add the following line, replacing
<serial number here>
with your sensor's serial number:SUBSYSTEM=="tty", ATTRS{serial}=="<serial number here>", ENV{ID_MM_DEVICE_IGNORE}="1", ATTR{device/latency_timer}="1", SYMLINK+="robot/dh_ag95_gripper"
-
Apply the changes:
sudo udevadm control --reload && sudo udevadm trigger
Launch the driver with the following command:
ros2 launch dh_gripper_driver dh_ag95_control.launch.py com_port:=/dev/robot/dh_ag95_gripper
To command the gripper to close, open another terminal and run this command:
ros2 topic pub /forward_position_controller/commands std_msgs/msg/Float64MultiArray "{data: [0.93]}"
Similarly, to open the gripper, use:
ros2 topic pub /forward_position_controller/commands std_msgs/msg/Float64MultiArray "{data: [0]}"
To view the URDF, use:
ros2 launch dh_ag95_description view_dh_ag95.launch.py