< >
Home » Turbot4-ARM仿真入门教程 » Turbot4-ARM仿真入门教程-通过命令控制机械爪

Turbot4-ARM仿真入门教程-通过命令控制机械爪

说明

  • 介绍如何通过命令控制机械爪

步骤

    1. 启动仿真
#加载仿真环境
. /usr/share/gazebo/setup.bash

#gazebo
ros2 launch interbotix_xslocobot_sim xslocobot_gz_classic_nav.launch.py robot_model:=locobot_wx200 verbose:=true 
  • gazebo效果图

请输入图片描述

    1. 相关命令
  • 机械臂关节通过话题/locobot/gripper_controller/joint_trajectory控制

  • 使用命令格式如下:

ros2 topic pub /locobot/gripper_controller/joint_trajectory trajectory_msgs/msg/JointTrajectory "header:
  stamp:
    sec: 0
    nanosec: 0
  frame_id: ''
joint_names: ['left_finger', 'right_finger']
points:
- positions: [1.0, -1.0]
  velocities: []
  accelerations: []
  effort: []
  time_from_start:
    sec: 1
    nanosec: 0"

  • 分别通过控制左手指和右手指开合
  • 通过positions来定义左手指和右手指关节的位置,位置采用弧度表示。
  • 可以通过srdf文件定义关节对应的姿态位
    <group_state name="Home" group="interbotix_gripper">
        <joint name="left_finger" value="0.0195" />
        <joint name="right_finger" value="-0.0195" />
    </group_state>
    <group_state name="Released" group="interbotix_gripper">
        <joint name="left_finger" value="0.037" />
        <joint name="right_finger" value="-0.037" />
    </group_state>
    <group_state name="Grasping" group="interbotix_gripper">
        <joint name="left_finger" value="0.015" />
        <joint name="right_finger" value="-0.015" />
    </group_state>
    1. home位
ros2 topic pub /locobot/gripper_controller/joint_trajectory trajectory_msgs/msg/JointTrajectory "header:
  stamp:
    sec: 0
    nanosec: 0
  frame_id: ''
joint_names: ['left_finger', 'right_finger']
points:
- positions: [0.0195, -0.0195]
  velocities: []
  accelerations: []
  effort: []
  time_from_start:
    sec: 1
    nanosec: 0"
  • rviz效果图

请输入图片描述

    1. 打开
ros2 topic pub /locobot/gripper_controller/joint_trajectory trajectory_msgs/msg/JointTrajectory "header:
  stamp:
    sec: 0
    nanosec: 0
  frame_id: ''
joint_names: ['left_finger', 'right_finger']
points:
- positions: [0.037, -0.037]
  velocities: []
  accelerations: []
  effort: []
  time_from_start:
    sec: 1
    nanosec: 0"
  • rviz效果图

请输入图片描述

    1. 关闭
ros2 topic pub /locobot/gripper_controller/joint_trajectory trajectory_msgs/msg/JointTrajectory "header:
  stamp:
    sec: 0
    nanosec: 0
  frame_id: ''
joint_names: ['left_finger', 'right_finger']
points:
- positions: [0.015, -0.015]
  velocities: []
  accelerations: []
  effort: []
  time_from_start:
    sec: 1
    nanosec: 0"
  • rviz效果图

请输入图片描述

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: turbot4-arm仿真入门教程