USB2 dynamixel+moveit控制AX-12A机械臂

2019-07-14 02:44发布

USB2 dynamixel+moveit控制AX-12A机械臂

环境

16.04

需要的package

dynamixel_motor turtlebot_arm arbotix_ros

说明

  1. dynamixel_motor包是专门提供给USB2 dynamixel的,可以通过这个教程创建moveit所需要的server,(start_meta_controller.launch)
  2. ros_by_example2里面有说一句,arbotix的包可以支持USB2 Dynamixel 和arbotix两种控制器,查看ros wiki中arbotix_ros中确实有说过当硬件是USB2 dynamixel时,需要把read/write当中的一个参数改为False,onbroad也得是false,波特率我也修改成1000000, ------------>尝试使用arbotix_ros控制dynamixel电机,但是结果是moveit当中规划成功了,显示执行完成,实际上电机没动,查看图发现arbotix节点没有跟机械臂通讯成功(以后可以再试试)
  3. 注意 start_meta_controller.launch当中的f_arm_controller是跟moveit中需要创建的controllers.yaml中的name相匹配
  4. turtlebot_arm这个包是通过arbotix来控制,我是使用USB2 dynamixel控制,arm的控制是通过 FollowJointTrajectory。gripper的话,在未改动的controllers.yaml文件当中是用一个gripper command来完成的,折腾了半天没能跟USB2 dynamixel跑成功,索性也用 FollowJointTrajectory这个吧23333333333
  5. 还有一些功能没有完成,比如controller_manager节点还没有跟/joint_state连接,还有很多没有完成,现在的进度是在实体机械臂上可以运行turtlebot_arm/turtlebot_arm_moveit_demo中的pick_and_place.py。
  6. 所使用的my_dynamixel_tutorial包是跟着dynamixel_motor的教程创建的,由于moveit当中,gripper跟arm是两个规划组,所以在这里面重要的是tilt.yaml(给手臂的四个电机)跟till.yaml(给gripper的一个电机)
  7. 关于gripper调用的arbotix包还没有搞清楚
  8. 我写的好乱,但是!!大丈夫!!!稍后上传github

运行

  1. 将USB2 dynamixel连接到电脑上,舵机供电
  2. roslaunch my_dynamixel_tutorial controller_manager.launch
    出现:
    [INFO] [1543806253.032527]: pan_tilt_port: Pinging motor IDs 1 through 25…
    [INFO] [1543806255.402648]: pan_tilt_port: Found 5 motors - 5 AX-12 [1, 2, 3, 4, 5], initialization complete.
    表示通讯成功
  3. roslaunch my_dynamixel_tutorial start_meta_controller.launch
    出现:
    process[controller_spawner_meta-2]: started with pid [29927]
    [INFO] [1543806263.730556]: pan_tilt_port controller_spawner: waiting for controller_manager dxl_manager to startup in global namespace…
    [INFO] [1543806263.742506]: pan_tilt_port controller_spawner: All services are up, spawning controllers…
    [INFO] [1543806263.751917]: meta controller_spawner: waiting for controller_manager dxl_manager to startup in global namespace…
    [INFO] [1543806263.756131]: meta controller_spawner: All services are up, spawning controllers…
    [INFO] [1543806263.779993]:
    [INFO] [1543806263.876295]: Controller arm_shoulder_pan_joint successfully started.
    [INFO] [1543806263.958328]: Controller arm_shoulder_lift_joint successfully started.
    [controller_spawner_meta-2] process has finished cleanly
    log file: /home/xingyi/.ros/log/1865a62a-f6a8-11e8-8a1d-54271eb20f16/controller_spawner_meta-2*.log
    [INFO] [1543806264.043534]: Controller arm_elbow_flex_joint successfully started.
    [INFO] [1543806264.145492]: Controller arm_wrist_flex_joint successfully started.
    [controller_spawner-1] process has finished cleanly
    log file: /home/xingyi/.ros/log/1865a62a-f6a8-11e8-8a1d-54271eb20f16/controller_spawner-1*.log
    all processes on machine have died, roslaunch will exit
    shutting down processing monitor…
    … shutting down processing monitor complete
    done
    成功
    这时rostopic list就可以看到
    /arm_elbow_flex_joint/command
    /arm_elbow_flex_joint/state
    /arm_shoulder_lift_joint/command
    /arm_shoulder_lift_joint/state
    /arm_shoulder_pan_joint/command
    /arm_shoulder_pan_joint/state
    /arm_wrist_flex_joint/command
    /arm_wrist_flex_joint/state

    /diagnostics
    /f_arm_controller/command
    /f_arm_controller/follow_joint_trajectory/cancel
    /f_arm_controller/follow_joint_trajectory/feedback
    /f_arm_controller/follow_joint_trajectory/goal
    /f_arm_controller/follow_joint_trajectory/result
    /f_arm_controller/follow_joint_trajectory/status
    /f_arm_controller/state
    /motor_states/pan_tilt_port
    /rosout
    /rosout_agg
    说明:/state /state前面的arm什么什么的是跟tilt.yaml中对应的
    另外在运行这个的时候,controller_manager.launch终端可能会出现一些warn,类似于 [f_arm_controller] not all dependencies started, still waiting for [‘arm_elbow_flex_joint’, ‘arm_shoulder_lift_joint’, ‘arm_shoulder_pan_joint’, ‘arm_wrist_flex_joint’]…这个时候不用管他
  4. roslaunch my_dynamixel_tutorial start_meta_controller2.launch
    再次查看topic list会看到增加了
    /b_arm_controller/command
    /b_arm_controller/follow_joint_trajectory/cancel
    /b_arm_controller/follow_joint_trajectory/feedback
    /b_arm_controller/follow_joint_trajectory/goal
    /b_arm_controller/follow_joint_trajectory/result
    /b_arm_controller/follow_joint_trajectory/status
    /b_arm_controller/state
/gripper_joint/command
/gripper_joint/state
  1. roslaunch turtlebot_arm_moveit_config demo.launch
    最后会出现You can start planning now!表示运行成功
  2. rosrun turtlebot_arm_moveit_demos pick_and_place.py
    这时候舵机和moveit中的界面都会动
  3. rrqt_graph待补充

相关链接

链接:http://wiki.ros.org/pr2_controllers/Tutorials/Moving the gripper
https://blog.csdn.net/lingchen2348/article/details/80300069
https://github.com/turtlebot/turtlebot_arm
http://wiki.ros.org/dynamixel_controllers/Tutorials
https://github.com/arebgun/dynamixel_motor
https://github.com/vanadiumlabs/arbotix_ros.git
https://blog.csdn.net/Kalenee/article/details/80643189
http://docs.ros.org/api/control_msgs/html/index-msg.html
http://question1979.rssing.com/chan-34076861/latest.php
http://docs.ros.org/jade/api/moveit_commander/html/classmoveit__commander_1_1move__group_1_1MoveGroupCommander.html