目录
参数配置
设定一系列变量及其默认值,并设定参数,后面引用其他launch文件传入参数需要用到。其中需要注意的是robot_description参数(urdf文件路径)虽然后面没有显性引用,但在其他launch文件里面需要用到,需要在调用之前设定好。
注:MoveIt Setup Assistant生成的demo_gazebo.launch文件中将路径设置为了生成moveit_config文件所用的那个xacro文件,但实际上应设为MoveIt Setup Assistant设置过程中在simulation窗口下生成的urdf代码对应的文件的路径(自己新建一个urdf文件并把内容粘贴进去)。
<!-- By default, we are not in debug mode -->
<arg name="debug" default="false" />
<!-- By default, we won't load or override the robot_description -->
<arg name="load_robot_description" default="false"/>
<!-- By default, use the urdf location provided from the package -->
<arg name="urdf_path" default="$(find motoman_gazebo)/config/mh12_gazebo.urdf"/>
<!-- send robot urdf to param server -->
<param name="robot_description" textfile="$(arg urdf_path)" />
move_group
启动move_group相关节点控制机器人。
<!-- Run the main MoveIt! executable without trajectory execution (we do not have controllers configured by default) -->
<include file="$(find motoman_mh12_moveit_config)/launch/move_group.launch">
<arg name="allow_trajectory_execution" value="true"/>
<arg name="fake_execution" value="false"/>
<arg name="info" value="true"/>
<arg name="debug" value="$(arg debug)"/>
<arg name="load_robot_description" value="$(arg load_robot_description)"/>
</include>
moveit_rviz
启动rviz查看机器人状态。
<!-- Run Rviz and load the default config to see the state of the move_group node -->
<include file="$(find motoman_mh12_moveit_config)/launch/moveit_rviz.launch">
<arg name="rviz_config" value="$(find motoman_mh12_moveit_config)/launch/moveit.rviz"/>
<arg name="debug" value="$(arg debug)"/>
</include>
整个launch文件
<launch>
<!-- By default, we are not in debug mode -->
<arg name="debug" default="false" />
<!-- By default, we won't load or override the robot_description -->
<arg name="load_robot_description" default="false"/>
<!-- By default, use the urdf location provided from the package -->
<arg name="urdf_path" default="$(find motoman_gazebo)/config/mh12_gazebo.urdf"/>
<!-- send robot urdf to param server -->
<param name="robot_description" textfile="$(arg urdf_path)" />
<!-- Run the main MoveIt! executable without trajectory execution (we do not have controllers configured by default) -->
<include file="$(find motoman_mh12_moveit_config)/launch/move_group.launch">
<arg name="allow_trajectory_execution" value="true"/>
<arg name="fake_execution" value="false"/>
<arg name="info" value="true"/>
<arg name="debug" value="$(arg debug)"/>
<arg name="load_robot_description" value="$(arg load_robot_description)"/>
</include>
<!-- Run Rviz and load the default config to see the state of the move_group node -->
<include file="$(find motoman_mh12_moveit_config)/launch/moveit_rviz.launch">
<arg name="rviz_config" value="$(find motoman_mh12_moveit_config)/launch/moveit.rviz"/>
<arg name="debug" value="$(arg debug)"/>
</include>
</launch>
Pingback: Moveit+Gazebo仿真 - Fivyex's Blog