2020年12月28日 星期一

[ROS] Gazebo: 開啟 turtlebot3_world.world

直接使用 Gazebo 指令開啟

 

使用 Gazebo 開啟 turtlebot3_gazebo 套件中的 turtlebot3_world.world,執行指令:

 

$ roscd turtlebot3_gazebo

$ gazebo worlds/turtlebot3_world.world

 

出現下列錯誤:

 

Error [parser.cc:581] Unable to find uri[model://turtlebot3_world]

 

發現在 turtlebot3_world.world 中,匯入了另一個模型文件:

 

-- turtlebot3_world.world

    … …

    <!-- Load world -->

    <include>

      <uri>model://turtlebot3_world</uri>

    </include>

    … …

 

該模型文件位於下列路徑中:

 

~/catkin_ws/src/turtlebot3_simulations/turtlebot3_gazebo/models

 

必須把這個路徑添加到 GAZEBO_MODEL_PATH 環境變數,執行指令:

 

$ export GAZEBO_MODEL_PATH=~/catkin_ws/src/turtlebot3_simulations/turtlebot3_gazebo/models:${GAZEBO_MODEL_PATH}

 

再次執行 gazebo worlds/turtlebot3_world.world 指令,就可以正常開啟 gazebo worlds/turtlebot3_world.world

 

 

 

使用 roslaunch 指令開啟

 

也可以編寫一個 launch 文件:

 

-- turtlebot3_world.launch

<launch>

  <include file="$(find gazebo_ros)/launch/empty_world.launch">

    <arg name="world_name" value="$(find turtlebot3_gazebo)/worlds/turtlebot3_world.world" />

  </include>

</launch>

 

使用 roslaunch 指令來執行:

 

$ roslaunch turtlebot3_world.launch

 

 

參考資料

 

  • Tutorial: Using roslaunch to start Gazebo, world files and URDF models

http://gazebosim.org/tutorials?tut=ros_roslaunch

 

沒有留言:

張貼留言

和我聯絡

名稱

以電子郵件傳送 *

訊息 *