Edit on GitHub

[ROS 2] Applications

Master and Slave

In this example, if the user is holding the master OpenManipulator, the slave OpenManipulator-X moves like master robot. Recording mode allows you to save the trajectory as you move the master OpenManipulator-X and play it back to the slave OpenManipulator.

Setup OpenManipulator-X

Since you need to control two OpenManipulators on one PC, use two U2D2s and two OpenManipulators to connect as shown below.

Master OpenManipulator

Master OpenManipulator-X is a robot that is controlled by the user. This is easy to move because no torque is applied to dynamixel. DYNAMIXEL of master OpenManipulator-X sets the ID as below and the baudrate as 1000000bps.

Name DYNAMIXEL ID
Joint 1 1
Joint 2 2
Joint 3 3
Joint 4 4
Gripper 5

Slave OpenManipulator

Slave OpenManipulator-X moves synchronously with Master OpenManipulator. DYNAMIXEL of slave OpenManipulator-X sets the ID as below and the baudrate as 1000000bps. This is the same as the default OpenManipulator-X setting.

Name DYNAMIXEL ID
Joint 1 11
Joint 2 12
Joint 3 13
Joint 4 14
Gripper 15

Install Package

Run the following command in a terminal window.

$ cd ~/robotis_ws/src/
$ git clone -b ros https://github.com/ROBOTIS-GIT/open_manipulator_applications.git
$ cd ~/robotis_ws && colcon build --symlink-install  

If the catkin_make command has been completed without any errors, all the preparations are done.

Execute Example

Run the controller of slave OpenManipulator. Open the other terminal window and enter the following command in the terminal.
dynamixel_usb_port is a parameter to set use port to connected with Dynamixel of slave OpenManipulator. It should be set /dev/ttyUSB@ and it is different from use port of master OpenManipulator.

$ ros2 launch open_manipulator_x_controller open_manipulator_x_controller.launch.py  

WARNING :
Please check each joint position before running OpenMANIPULATOR-X. It might stop operation because of joint position out of range.
The picture on the below is showing you the ideal pose of OpenMANIPULATOR-X. Please adjust each joints along with the following picture when DYNAMIXEL torque isn’t enabled.

And Open the other terminal window and enter the following command in the terminal. This command is to run the controller of master OpenManipulator.
usb_port is a parameter to set use port to connected with Dynamixel of master OpenManipulator. It should be set /dev/ttyUSB@ and it is different from use port of slave OpenManipulator.

If the master OpenManipulator-X controller has been launched successfully, the terminal will show the following message.

port_name and baud_rate are set to /dev/ttyUSB0, 1000000 
Joint Dynamixel ID : 11, Model Name : XM430-W350
Joint Dynamixel ID : 12, Model Name : XM430-W350
Joint Dynamixel ID : 13, Model Name : XM430-W350
Joint Dynamixel ID : 14, Model Name : XM430-W350
Gripper Dynamixel ID : 15, Model Name :XM430-W350
[INFO] Succeeded to Initialise OpenManipulator-X Controller

And Open the other terminal window and enter the following command in the terminal. This command is to run the controller of master OpenManipulator.
usb_port is a parameter to set use port to connected with DYNAMIXEL of master OpenManipulator. It should be set /dev/ttyUSB@ and it is different from use port of slave OpenManipulator.

$ ros2 run open_manipulator_x_master_slave open_manipulator_x_master_slave

If the slave OpenManipulator-X controller has been launched successfully, the terminal will show the following message.

port_name and baud_rate are set to /dev/ttyUSB1, 1000000 
Joint Dynamixel ID : 1, Model Name : XM430-W350
Joint Dynamixel ID : 2, Model Name : XM430-W350
Joint Dynamixel ID : 3, Model Name : XM430-W350
Joint Dynamixel ID : 4, Model Name : XM430-W350
Gripper Dynamixel ID : 5, Model Name :XM430-W350

So, you can see the following message in the terminal window. You can check the current control mode and robot status(joint angle, tool position).

-----------------------------
Control Your OpenManipulator!
-----------------------------
Present Control Mode
Master - Slave Mode
-----------------------------
1 : Master - Slave Mode
2 : Start Recording Trajectory
3 : Stop Recording Trajectory
4 : Play Recorded Trajectory
-----------------------------
Present Joint Angle J1: -0.170 J2: 0.367 J3: -0.046 J4: 0.959
Present Tool Position: 0.000
-----------------------------

There are four control modes. Please enter that number in the terminal.

  1. Master-Slave Mode: Master robot and slave robot move synchronously.
  2. Start Recording Trajectory: Master robot and slave robot move synchronously and the controller records the moving trajectory.
  3. Stop Recording Trajectory: Ends the recording.
  4. Play Recorded Trajectory: The trajectory recorded in the 2nd mode is reproduced only by the slave robot.