設定 GAZEBO_MODEL_PATH 環境變數
因為 turtlebot3_burger 的 SDF 模型位於:
~/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 的 world 文件
接著,新增一個 world 文件如下:
-- turtlebot3_burger.world
<sdf version='1.6'> <world name='default'> <!-- A global light source --> <include> <uri>model://sun</uri> </include>
<!-- A ground plane --> <include> <uri>model://ground_plane</uri> </include>
<!-- Load model --> <include> <uri>model://turtlebot3_burger</uri> </include> </world> </sdf> |
在這個 world 文件中,載入了一個光源 (sun)、一個地面 (ground_plane),再來就是 turtlebot3_burger 的模型。
使用 Gazebo 指令開啟 world 文件
使用 Gazebo 開啟剛剛建立的 world 文件:
$ gazebo turtlebot3_burger.world |
如果沒有問題的話,應該可以看到下面這個畫面:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheaJG_jFEi-IpPQ7f7yEkWZUDPOiFqD8emGxmGmlsxMXS8Yav7RGP3rhRT37rz7qBnN7CWI8096m55Z4TyBi9itFlUTFLLXp0ctspwfIcW-dc_-9_Y5QYDqiBfw3vDx7FYplYK4r3ptAE/s0/model.png)
參考資料
- Tutorial: Using roslaunch to start Gazebo, world files and URDF models
http://gazebosim.org/tutorials?tut=ros_roslaunch
- 【ROS-Gazebo】SDF的建模与使用
https://www.guyuehome.com/7113
沒有留言:
張貼留言