第十章 Moveit!机械臂控制

10.8 配置Moveit关节控制器

使用虚拟控制器ArbotiX关节控制器可以实现通过FollowJiontTrajectory-Action类型的action消息来控制模型运动,但是当需要将其与Moveit规划出的结果发给ArbotiX关节控制器时,这两者之间需要一个连接的接口,该接口以插件形式提供,即为moveit_simple_controller_manager,这个manager提供了FollowJiontTrajectoryAction接口,将规划的结果以action的形式发布,此外,moveit_simple_controller_manager同样提供了末端夹具的接口GripperCommandAction,实现gripper——controller 的驱动,1

1.如何配置相关接口文件

在marm_moveit_config下的config下设置配置文件controller.yaml.

该文件列出了配置参数,具体的参数有:

name:插件名称

action_ns:发布action消息的命名空间,这也是将Moveit规划的轨迹路线输出的一个通道。

type:实现action的类型

default:是否为该规划组的默认控制插件

joints:规划包含的 关节

2.该插件在Moveit-setup-assistant配置的launch文件下的marm_moveit_controller_manager.launch.yaml下导入,在move_group.launch启动时启动导入。,

3.indigo和Kinectic的区别

1)在move_group的C++API中的接口不一样,其中声明move_group节点中的机械臂实例组时,

indigo API:moveit::planning_interface::MoveGroup group("arm");

kinectic API :moveit::planning_interface::MoveGroupInterface group("arm");

2) 在urdf.xacro文件中插入Transmission for ROS control 插件时,

indigo:

<!-- Transmissions for ROS Control -->
    <xacro:macro name="transmission_block" params="joint_name">
        <transmission name="tran1">
            <type>transmission_interface/SimpleTransmission</type>
            <joint name="${joint_name}">
                <hardwareInterface>PositionJointInterface</hardwareInterface>
            </joint>
            <actuator name="motor1">
                <hardwareInterface>PositionJointInterface</hardwareInterface>
                <mechanicalReduction>1</mechanicalReduction>
            </actuator>
        </transmission>
    </xacro:macro>
 

kinectic:

<!-- Transmissions for ROS Control -->
    <xacro:macro name="transmission_block" params="joint_name">
        <transmission name="tran1">
            <type>transmission_interface/SimpleTransmission</type>
            <joint name="${joint_name}">
                <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
            </joint>
            <actuator name="motor1">
                <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
                <mechanicalReduction>1</mechanicalReduction>
            </actuator>
        </transmission>
    </xacro:macro>
 

10.12 使用Moveit控制Gazebo中的机械臂

10.12.1关节轨迹控制器

Moveit完成运动规划后的输出接口是名为"FollowJointTrajectory"的action,其中包含一系列规划好的路径点轨迹,为将这些轨迹提供给Gazebo进行仿真,ros_control设计了一个名为:Joint Trajectory Controller的控制器插件,

其控制一组joint在关节空间运动,通过接受路径点信息,可以使用样条插补函数计算得到机器人各关节的周期位置,其中样条插补函数有线性样条(只保证位置连续,速度和加速度不连续)、三次样条(保证位置速度连续,加速度不连续)、和五次样条(保证位置速度加速度都连续)。该控制器的配置文件为maram_gazebo/config/trajectory_control.yaml,改配置文件下可设置关节的PID参数,并且通过maram_gazebo/launch/arm_trajectory_controller.launch,加载。

10.12.2Moveit控制器配置文件

为实现将规划好的路径点顺利与Gazebo的Joint Trajectory Controller的控制器插件进行通信,需要重新配置moveit_configd下的控制器,即controller_gazebo.yaml文件,

controller_gazebo.yaml和不需要连接的Gazebo时建立的控制器配置文件controller.yaml的主要的区别就是添加了命名空间,该命名空间在arm.xcaro文件中Gazebo插件声明出有涉及,具体涉及内容如下:

    <!-- ros_control plugin -->
    <gazebo>
        <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
            <robotNamespace>/arm</robotNamespace>   //【/arm】即为命名空间,
        </plugin>
    </gazebo>

而在controller_gazebo.yaml中,需要添加在控制器前面加/arm,即:

controller_manager_ns: controller_manager
controller_list:
  - name: arm/arm_joint_controller
    action_ns: follow_joint_trajectory
    type: FollowJointTrajectory
    default: true
    joints:
      - joint1
      ........

  - name: arm/gripper_controller
    action_ns: follow_joint_trajectory
    type: FollowJointTrajectory
    default: true
    joints:
     .....

注意:修改后,该配置文件由moveit_config下的arm_moveit_controller_manager.launch加载,

10.12.3关节状态控制器

是一个可选的插件,作用在于发布机器人关节状态和TF变换,否则rviz中的Fixed Frame 设置中看不到下拉的坐标系选型

其配置文件为marm_gazebo/config/arm_gazebo_joint_states.yaml,并在marm_gazebo/launch/arm_gazebo_states.launch中加载。

猜你喜欢

转载自blog.csdn.net/cookie909/article/details/84310505
今日推荐