< >
Home » Ailibot仿真机器人入门教程 » Ailibot仿真入门教程-gazebo-加载Gazebo场景

Ailibot仿真入门教程-gazebo-加载Gazebo场景

文章说明

  • 本教程主要介绍如何在gazebo上加载Gazebo场景
  • 测试环境:Ubuntu 20.04 + Gazebo11

操作步骤

  • 上篇文章中,我们制作了一个简单的场景,现在加载Gazebo场景
  • 进入到ailibot_gazebo/launch文件夹下,新建test_world.launch
$ roscd ailibot_gazebo/launch
$ vim test_world.launch

<launch>
  <arg name="x_pos" default="0.0"/>
  <arg name="y_pos" default="0.0"/>
  <arg name="z_pos" default="0.0"/>
  
  <arg name="model" default="$(env AILIBOTBASE)" />
  
  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find ailibot_gazebo)/worlds/test.world"/>
    <arg name="paused" value="false"/>
    <arg name="use_sim_time" value="true"/>
    <arg name="gui" value="true"/>
    <arg name="headless" value="false"/>
    <arg name="debug" value="false"/>
  </include>
  
  <arg name="urdf_file" default="$(find xacro)/xacro --inorder '$(find ailibot_description)/urdf/d4/ailibot_$(arg model).urdf.xacro'" />
  <param name="robot_description" command="$(arg urdf_file)" />
  
  <node pkg="gazebo_ros" type="spawn_model" name="spawn_urdf" args="-urdf -model ailibot_urdf -x $(arg x_pos) -y $(arg y_pos) -z $(arg z_pos) -param robot_description" />
  
  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher"/>
  
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher">
    <param name="publish_frequency" type="double" value="50.0" />
    <param name="use_tf_static"  value="false" />
  </node>
</launch>
  • 编译
$ cd ~/ros1_ailibot_sim_ws
$ catkin_make
  • 启动加载Gazebo场景同时加载机器人模型
$ roslaunch ailibot_gazebo test_world.launch

e859fcd0fbd25f7d86afe3fea6d75bdb.png

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

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


标签: ailibot仿真入门教程