伺服电机选用Robotis Dynamixel, 棒子品牌。 实时的位置反馈,速度和扭力。 低端的AX-12。 一个某宝上最便宜也要310RMB.
在本章中,我们将讨论以下议题:
•添加云台到TurtleBot
•选择Dynamixel控制器和ROS包
•了解ROS JointState消息类型
•使用基本的 joint 控制命令
•连接硬件控制器和设置伺服IDs
•配置的启动文件和参数
•测试舵机
•头跟踪节点编程
•组合头脸部追踪
12.1 带云台的TurtleBot
$roslaunch rbx1_description test_turtlebot_with_head.launch
$rosrun rviz rviz -d `rospack find rbx1_description`/urdf.rviz
12.2选择一个Dynamixel硬件控制器
12.4选择一个ROS Dynamixel包
arbotix 第二卷讲, dynamixel_motor
sudo apt-get install ros-indigo-dynamixel-motor
12.5了解ROS JointState消息类型
$rosmsg show sensor_msgs/JointState
Header header
uint32 seq
time stamp
string frame_id
string[] name
float64[] position
float64[] velocity
float64[] effort
12.6控制关节位置,速度和扭矩
12.6.1设置伺服位置
<joint_controller_name>/command
$rostopic pub -1 /head_pan_joint/command std_msgs/Float64 -- -1.0
12.6.2设置伺服速度
$rosservice call /head_pan_joint/set_speed 0.5
12.6.3控制伺服扭矩
dynamixel控制器提供与两种扭矩服务:torque_enable 或者set_torque_limit。
$rosservice call /head_pan_joint/torque_enable False
$rosservice call /head_pan_joint/torque_enable True
12.8设置伺服硬件ID
12.9配置和启动dynamixel控制器