Please refer to the following for the ROS installation procedure.
$ mkdir ~/catkin_ws/src/ -p
$ cd ~/catkin_ws/src/
# Clone dependency packages
$ git clone https://github.com/ROBOTIS-GIT/DynamixelSDK.git
$ git clone https://github.com/ROBOTIS-JAPAN-GIT/rakuda2_example.git
# Install package
$ sudo apt-get update
$ sudo apt-get install ros-$ROS_DISTRO-realsense2-camera
# Build and source
$ cd ~/catkin_ws && catkin_make
$ source ~/catkin_ws/devel/setup.bash
# Set Realsense serial number
# Connect realsense to your PC and enter the following command.
$ rs-enumerate-devices
# Check the serial number.
$ cd ~/catkin_ws/src/rakuda2_example/launch
# Enter the serial number you just checked in the default field.
$ nano rakuda2_master.launch
# <arg name="serial_no" default=""/>
# Set DYNAMIXEL Port
# Connect U2D2 to your PC and enter the following command.
$ dmesg | tail -n 10
# [10975.907715] ftdi_sio 1-5:1.0: device disconnected
# [10981.622547] usb 1-5: new high-speed USB device number 9 using xhci_hcd
# [10981.775790] usb 1-5: New USB device found, idVendor=0403, idProduct=6014, bcdDevice= 9.00
# [10981.775795] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
# [10981.775798] usb 1-5: Product: USB <-> Serial Converter
# [10981.775801] usb 1-5: Manufacturer: FTDI
# [10981.775803] usb 1-5: SerialNumber: FT3FSIF9
# [10981.780300] ftdi_sio 1-5:1.0: FTDI USB Serial Device converter detected
# [10981.780375] usb 1-5: Detected FT232H
# [10981.781315] usb 1-5: FTDI USB Serial Device converter now attached to ttyUSB0
# Enter the USB port you just checked in the default field.
$ nano rakuda2_master.launch
# <arg name="usb_port" default="/dev/ttyUSB0"/>
# Copy rules file
$ cd ~/catkin_ws/src/rakuda2_example/
$ sudo cp ./99-rakuda2-cdc.rules /etc/udev/rules.d/
$ sudo udevadm control --reload-rules
$ sudo udevadm trigger
roslaunch rakuda2_example rakuda2_master.launch
In master mode, it moves to the initial position, and after 3s, the torque of all the motors is disabled. The data of each joint is published in the "/joint state".
roslaunch rakuda2_example rakuda2_slave.launch
In slave mode, it moves to the initial position, and the all motor torque is enabled. The data obtained from the "/joint state" is written to each joint.
rosbag recoard -a -O rakuda_data.bag
or
roslaunch rakuda2_example topic2bag.launch
Note: Save only the topics specified in the launch file.
rosbag play output.bag
roslaunch rakuda2_example bag2image.launch input_file_name:=output.bag topic_name:=/camera_slave/color/image_raw