< >
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/arm_controller/joint_trajectory控制

  • 使用命令格式如下:

ros2 topic pub /locobot/arm_controller/joint_trajectory trajectory_msgs/msg/JointTrajectory "header:
  stamp:
    sec: 0
    nanosec: 0
  frame_id: ''
joint_names: ['waist', 'shoulder', 'elbow','wrist_angle', 'wrist_rotate']
points:
- positions: [0.0, 0.0, 0.0, 0.0, 0.0 ]
  velocities: []
  accelerations: []
  effort: []
  time_from_start:
    sec: 1
    nanosec: 0"
  • 关节由上到上,分别是'waist', 'shoulder', 'elbow','wrist_angle', 'wrist_rotate'
  • 腰部,肩部,肘部,腕部角度,腕部旋转
  • 通过positions来定义各个关节的位置,位置采用弧度表示。0对应0度,1.57对应90度,3.14对应360度
  • 可以通过srdf文件定义关节对应的姿态位
 <group_state name="Home" group="interbotix_arm">
        <joint name="elbow" value="0" />
        <joint name="shoulder" value="0" />
        <joint name="waist" value="0" />
        <joint name="wrist_angle" value="0" />
        <joint name="wrist_rotate" value="0" />
    </group_state>
    <group_state name="Sleep" group="interbotix_arm">
        <joint name="elbow" value="1.55" />
        <joint name="shoulder" value="-1.3" />
        <joint name="waist" value="0" />
        <joint name="wrist_angle" value="0.7" />
        <joint name="wrist_rotate" value="0" />
    </group_state>
    <group_state name="Upright" group="interbotix_arm">
        <joint name="elbow" value="-1.5708" />
        <joint name="shoulder" value="0" />
        <joint name="waist" value="0" />
        <joint name="wrist_angle" value="0" />
        <joint name="wrist_rotate" value="0" />
    </group_state>
    1. home位,所有关节都是0
ros2 topic pub /locobot/arm_controller/joint_trajectory trajectory_msgs/msg/JointTrajectory "header:
  stamp:
    sec: 0
    nanosec: 0
  frame_id: ''
joint_names: ['waist', 'shoulder', 'elbow','wrist_angle', 'wrist_rotate']
points:
- positions: [0.0, 0.0, 0.0, 0.0, 0.0 ]
  velocities: []
  accelerations: []
  effort: []
  time_from_start:
    sec: 1
    nanosec: 0"
  • rviz效果图

请输入图片描述

    1. 站立位Upright
ros2 topic pub /locobot/arm_controller/joint_trajectory trajectory_msgs/msg/JointTrajectory "header:
  stamp:
    sec: 0
    nanosec: 0
  frame_id: ''
joint_names: ['waist', 'shoulder', 'elbow','wrist_angle', 'wrist_rotate']
points:
- positions: [0.0, 0.0, -1.57, 0.0, 0.0 ]
  velocities: []
  accelerations: []
  effort: []
  time_from_start:
    sec: 1
    nanosec: 0"
  • rviz效果图

请输入图片描述

    1. 睡眠位sleep
ros2 topic pub /locobot/arm_controller/joint_trajectory trajectory_msgs/msg/JointTrajectory "header:
  stamp:
    sec: 0
    nanosec: 0
  frame_id: ''
joint_names: ['waist', 'shoulder', 'elbow','wrist_angle', 'wrist_rotate']
points:
- positions: [0.0, -1.3, 1.55, 0.7, 0.0 ]
  velocities: []
  accelerations: []
  effort: []
  time_from_start:
    sec: 1
    nanosec: 0"
  • rviz效果图

请输入图片描述

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

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


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