当前位置:   article > 正文

双臂采用moveit和gazebo联合仿真配置文件_moveit gazebo 配置

moveit gazebo 配置

目的:将moveit的规划好的路径传给gazebo

主要的难点添加控制器命名要相对应。

moveit处配置

1、新建gazebo中的控制器

 在moveit内新建controllers_gazebo.yaml ,其与controllers.yaml类似;(主要是命名空间)

  1. controller_manager_ns: controller_manager
  2. controller_list:
  3. - name: arm/left_rm65_controller
  4. action_ns: follow_joint_trajectory
  5. type: FollowJointTrajectory
  6. default: true
  7. joints:
  8. - L1_joint
  9. - L2_joint
  10. - L3_joint
  11. - L4_joint
  12. - L5_joint
  13. - L6_joint
  14. - name: arm/right_rm65_controller
  15. action_ns: follow_joint_trajectory
  16. type: FollowJointTrajectory
  17. default: true
  18. joints:
  19. - R1_joint
  20. - R2_joint
  21. - R3_joint
  22. - R4_joint
  23. - R5_joint
  24. - R6_joint
  25. - name: arm/dh_gripper_controller
  26. action_ns: follow_joint_trajectory
  27. type: FollowJointTrajectory
  28. default: true
  29. joints:
  30. - L1_tool_trans
  31. - L2_tool_trans

2、去改moveit的double_arm_moveit_controller_manager.launch.xml添加controllers配置

  1. <launch>
  2. <!-- Define the controller manager plugin to use for trajectory execution -->
  3. <param name="moveit_controller_manager" value="moveit_simple_controller_manager/MoveItSimpleControllerManager" />
  4. <!-- loads controller list to the param server -->
  5. <!--moveit单独使用,采用这个控制器-->
  6. <!--<rosparam file="$(find double_arm_moveit_config)/config/ros_controllers.yaml"/>-->
  7. <!--moveit与真实机械臂联用,采用这个控制器-->
  8. <!-- <rosparam file="$(find double_arm_moveit_config)/config/controllers.yaml"/>-->
  9. <!--moveit与gazebo联合仿真,采用这个控制器-->
  10. <rosparam file="$(find double_arm_moveit_config)/config/controllers_gazebo.yaml"/>
  11. </launch>

 3、在moveit中创建moveit_planning_execution.launch(中文标注处需要修改)加/

  1. <launch>
  2. # The planning and execution components of MoveIt! configured to
  3. # publish the current configuration of the robot (simulated or real)
  4. # and the current state of the world as seen by the planner
  5. <include file="$(find double_arm_moveit_config)/launch/move_group.launch">
  6. <arg name="publish_monitored_planning_scene" value="true" />
  7. </include>
  8. # The visualization component of MoveIt!
  9. <include file="$(find double_arm_moveit_config)/launch/moveit_rviz.launch"/>
  10. <!-- We do not have a robot connected, so publish fake joint states -->
  11. <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
  12. <param name="/use_gui" value="false"/>
  13. <!--根据控制器的不同设置不同-->
  14. <rosparam param="/source_list">[/arm/joint_states]</rosparam>
  15. </node>
  16. </launch>

robot端配置

4、gazebo/config 目录下的double_arm_trajectory_control.yaml 配置文件(对应上文3中文处)

  1. arm:
  2. left_rm65_controller:
  3. type: "position_controllers/JointTrajectoryController"
  4. joints:
  5. - L1_joint
  6. - L2_joint
  7. - L3_joint
  8. - L4_joint
  9. - L5_joint
  10. - L6_joint
  11. gains:
  12. L1_joint: {p: 1000.0, i: 0.0, d: 0.1, i_clamp: 0.0}
  13. L2_joint: {p: 1000.0, i: 0.0, d: 0.1, i_clamp: 0.0}
  14. L3_joint: {p: 1000.0, i: 0.0, d: 0.1, i_clamp: 0.0}
  15. L4_joint: {p: 1000.0, i: 0.0, d: 0.1, i_clamp: 0.0}
  16. L5_joint: {p: 1000.0, i: 0.0, d: 0.1, i_clamp: 0.0}
  17. L6_joint: {p: 1000.0, i: 0.0, d: 0.1, i_clamp: 0.0}
  18. right_rm65_controller:
  19. type: "position_controllers/JointTrajectoryController"
  20. joints:
  21. - R1_joint
  22. - R2_joint
  23. - R3_joint
  24. - R4_joint
  25. - R5_joint
  26. - R6_joint
  27. gains:
  28. R1_joint: {p: 1000.0, i: 0.0, d: 0.1, i_clamp: 0.0}
  29. R2_joint: {p: 1000.0, i: 0.0, d: 0.1, i_clamp: 0.0}
  30. R3_joint: {p: 1000.0, i: 0.0, d: 0.1, i_clamp: 0.0}
  31. R4_joint: {p: 1000.0, i: 0.0, d: 0.1, i_clamp: 0.0}
  32. R5_joint: {p: 1000.0, i: 0.0, d: 0.1, i_clamp: 0.0}
  33. R6_joint: {p: 1000.0, i: 0.0, d: 0.1, i_clamp: 0.0}
  34. dh_gripper_controller:
  35. type: "position_controllers/JointTrajectoryController"
  36. joints:
  37. - L1_tool_trans
  38. - L2_tool_trans
  39. gains:
  40. L1_tool_trans: {p: 50.0, d: 1.0, i: 0.01, i_clamp: 1.0}
  41. L2_tool_trans: {p: 50.0, d: 1.0, i: 0.01, i_clamp: 1.0}

5、在gazebo中创建launch文件运行4中建立的yaml(double_arm_trajectory_controller.launch)

  1. <launch>
  2. <rosparam file="$(find double_arm_gazebo)/config/double_arm_trajectory_control.yaml" command="load"/>
  3. <node name="arm_controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
  4. output="screen" ns = "/arm" args="left_arm_controller gripper_controller right_arm_controller"/>
  5. </launch>

6、创建关节状态控制器(发布机器人的关节状态和TF变换)

config内创建double_arm_gazebo_joint_states.yaml

  1. arm:
  2. joint_state_controller:
  3. type: joint_state_controller/JointStateController
  4. publish_rate: 50

launch文件创建double_arm_gazebo_states.launch 去运行yaml文件(remap映射从moveit映射到gazebo)

  1. <launch>
  2. <!-- 将关节控制器的配置参数加载到参数服务器中 -->
  3. <rosparam file="$(find double_arm_gazebo)/config/double_arm_gazebo_joint_states.yaml" command="load"/>
  4. <node name="joint_controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
  5. output="screen" ns = "arm" args = "joint_state_controller"/>
  6. <!-- 运行robot_state_publisher节点,发布tf -->
  7. <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"
  8. respawn="false" output="screen">
  9. <remap from="/joint_states" to="/arm/joint_states" />
  10. </node>
  11. </launch>

7、创建arm_world.launch文件去运行gazebo

  1. <launch>
  2. <!-- these are the arguments you can pass this launch file, for example paused:=true -->
  3. <arg name="paused" default="false"/>
  4. <arg name="use_sim_time" default="true"/>
  5. <arg name="gui" default="true"/>
  6. <arg name="headless" default="false"/>
  7. <arg name="debug" default="false"/>
  8. <!-- We resume the logic in empty_world.launch -->
  9. <include file="$(find gazebo_ros)/launch/empty_world.launch">
  10. <arg name="debug" value="$(arg debug)" />
  11. <arg name="gui" value="$(arg gui)" />
  12. <arg name="paused" value="$(arg paused)"/>
  13. <arg name="use_sim_time" value="$(arg use_sim_time)"/>
  14. <arg name="headless" value="$(arg headless)"/>
  15. </include>
  16. <!-- Load the URDF into the ROS Parameter Server -->
  17. <param name="robot_description" command="$(find xacro)/xacro --inorder '$(find double_arm_description)/urdf/double_arm_description.urdf.xacro'" />
  18. <!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
  19. <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen"
  20. args="-urdf -model dual_arm -param robot_description"/>
  21. </launch>

8、建立一个launch文件(arm_bringup_moveit.launch)去驱动所有的launch文件

  1. <launch>
  2. <!--arg name="rvizconfig" default="$(find dual_arm_gazebo)/config/rviz_gazebo.rviz"/-->
  3. <!-- Launch Gazebo -->
  4. <include file="$(find dual_arm_gazebo)/launch/arm_world.launch" />
  5. <!-- ros_control arm launch file -->
  6. <include file="$(find dual_arm_gazebo)/launch/arm_gazebo_states.launch" />
  7. <!-- ros_control trajectory control dof arm launch file -->
  8. <include file="$(find dual_arm_gazebo)/launch/arm_trajectory_controller.launch" />
  9. <!-- moveit launch file -->
  10. <include file="$(find dual_arm_moveit_config)/launch/moveit_planning_execution.launch" />
  11. </launch>

二、出现的问题有:

1、

sudo apt install ros-noetic-ros-controllers

2、

sudo apt install ros-noetic-joint-trajectory-controller

3、#include <rm_75_msgs/JointPos.h>有波浪线

在json文件上包含文件路径

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/703770
推荐阅读
相关标签
  

闽ICP备14008679号