一、建立自己Robot的URDF文件
1.如果你有一个自己的URDF机器人模型,您可以在Arbotix模拟器运行它。如果没有就自己建立一个。
2.首先复制fake_turtlebot.launch文件
$ roscd rbx1_bringup/launch $ cp fake_turtlebot.launch fake_my_robot.launch
3.在你最喜欢的编辑器中打开您的启动文件fake_my_robot.launch。首先,它会像这样:
<launch> <param name="/use_sim_time" value="false" /> <!-- Load the URDF/Xacro model of our robot --> <arg name="urdf_file" default="$(find xacro)/xacro.py '$(find rbx1_description)/urdf/turtlebot.urdf.xacro'" /> <param name="robot_description" command="$(arg urdf_file)" /> <node name="arbotix" pkg="arbotix_python" type="arbotix_driver" output="screen"> <rosparam file="$(find rbx1_bringup)/config/fake_turtlebot_arbotix.yaml" command="load" /> <param name="sim" value="true"/> </node> <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher"> <param name="publish_frequency" type="double" value="20.0" /> </node> </launch>
4.如您所见,URDF模型的加载是代码的顶部那里。如果你想使用自己的URDF,只需要简单的替换包和路径名指向自己的URDF / Xacro文件。就像下面这样:
<launch> <!-- Load the URDF/Xacro model of our robot --> <arg name="urdf_file" default="$(find xacro)/xacro.py '$(find YOUR_PACKAGE_NAME)/YOUR_URDF_PATH'" /> <param name="robot_description" command="$(arg urdf_file)" /> <node name="arbotix" pkg="arbotix_python" type="arbotix_driver" output="screen"> <rosparam file="$(find rbx1_bringup)/config/fake_turtlebot_arbotix.yaml" command="load" /> <param name="sim" value="true"/> </node> <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher"> <param name="publish_frequency" type="double" value="20.0" /> </node> </launch>
5.最后将launch文件按我上篇文章的所述运行就可以了。运行效果如下: