2017年5月17日 星期三

ROS使用Dynamixel Package


●  對於Dynamixel 1.0 protocol的馬達,可以使用package [dynamixel-motor]。


1. $ sudo apt-get install ros-kinetic-dynamixel-motor
2. $ roslaunch dynamixel_tutorials contorller_manager.launch




●  但對於使 用Dynamixel 2.0 protocol的馬達,package dynamixel-motor會無法辨識。因此要改為使用dynamixel-workbench-controller



Step 1: Install ROS package
$ sudo apt-get install ros-kinetic-dynamixel-workbench-controller

Step 2: Create package
$ roscreate-pkg my_dynamixel_workbench_tutorial dynamixel_workbench_single_manager std_msgs roscpp

Step 3: Create a launch file for the single manager node
1. Make a launch file in ros package which we created
$ cd my_dynamixel_workbench_tutorial
$ mkdir launch
$ cd launch
$ vim single_manager.launch

2. Type or copy&paste code below to connect dynamixel_workbench_single manager packages and set parameters
<launch>
  <arg name="device_name" default="/dev/ttyUSB0"/>
  <arg name="baud_rate" default="115200"/>

  <param name="device_name"      value="$(arg device_name)"/>
  <param name="baud_rate"        value="$(arg baud_rate)"/>

  <node name="single_manager_tutorial" pkg="dynamixel_workbench_single_manager" type="dynamixel_workbench_single_manager" required="true" output="screen"/>
</launch>

3. Before we operating this package, we need to access permission for USB device
$ sudo chmod a+rw /dev/ttyUSB0

4. Now we can run tutorial package:
$ roslaunch my_dynamixel_workbench_tutorial single_manager.launch

Step 4: Check state of Dynamixel
Now, we can check a state of linked Dynamixel through /dynamixel_workbench_single_manager/motor_state topic:
$ rostopic echo /dynamixel_workbench_single_manager/motor_state


Step 5: Send command to Dynamixel
We operate a Dynamixel using command. Address names can be checked published message or using table command. 
 [CMD]torque_enable 1
 [CMD]goal_position 2048

#1. Run single_manager and single_manager_gui
And we run single_manager_gui:
$ rosrun dynamixel_workbench_single_manager_gui dynamixel_workbench_single_manager_gui

#2. Controlled by roscpp

github - test for ROS dynamixel_workbench_single_manager(set position)


參考資料:

沒有留言:

張貼留言

apt-get update異常處理

1. 問題描述 系統環境:Ubuntu 18.04.3 LTS 執行apt-get update更新時遇到如下狀況 錯誤訊息: Err:1 http://security.ubuntu.com/ubuntu bionic-security InRe...