警告:不要在 TurtleBot3 的 SBC 端執行此節指令。 請在 remote PC 上按照此節步驟進行操作。
1. 增加 GAZEBO_MODEL_PATH 路徑
$ echo '# Add gazebo model path' >> ~/.bashrc
$ echo 'export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/turtlebot3_ws/src/turtlebot3/turtlebot3_simulations/turtlebot3_gazebo/models' >> ~/.bashrc
$ source ~/.bashrc
2. 在 Turtlebot3 world 地圖載入 TB3
$ export TURTLEBOT3_MODEL=${TB3_MODEL}
$ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
3. 啟動 Cartographer
$ ros2 launch turtlebot3_cartographer cartographer.launch.py use_sim_time:=True
4. 執行 teleoperation node 節點
$ export TURTLEBOT3_MODEL=${TB3_MODEL}
$ ros2 run turtlebot3_teleop teleop_keyboard
5. 儲存地圖
$ ros2 run nav2_map_server map_saver -f ~/map
6. 載入TB3 模型然後以下指令啟動 Navigation2
$ export TURTLEBOT3_MODEL=${TB3_MODEL}
$ ros2 launch turtlebot3_navigation2 navigation2.launch.py use_sim_time:=True map:=$HOME/map.yaml