SLAM Simulation
When SLAM in Gazebo simulator, you can select or create various environments and robot models in virtual world. Other than preparing simulation environment instead of bringing up the robot, SLAM Simulation is pretty similar to that of SLAM with the actual TurtleBot3.
The following instructions require prerequisites from the previous sections, so please review to the Simulation section first.
Launch Simulation World
Three Gazebo environments are prepared, but for creating a map with SLAM, it is recommended to use either TurtleBot3 World or TurtleBot3 House.
Use one of the following commands to load the Gazebo environment.
In this instruction, TurtleBot3 World will be used.
Please use the proper keyword among burger
, waffle
, waffle_pi
for the TURTLEBOT3_MODEL
parameter.
[Remote PC]
$ export TURTLEBOT3_MODEL=burger
$ roslaunch turtlebot3_gazebo turtlebot3_world.launch
Read more about How to load TurtleBot3 House
$ export TURTLEBOT3_MODEL=burger
$ roslaunch turtlebot3_gazebo turtlebot3_house.launch
Run SLAM Node
Open a new terminal from Remote PC with Ctrl
+ Alt
+ T
and run the SLAM node. Gmapping SLAM method is used by default.
Please use the proper keyword among burger
, waffle
, waffle_pi
for the TURTLEBOT3_MODEL
parameter.
[Remote PC]
$ export TURTLEBOT3_MODEL=burger
$ roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=gmapping
Run Teleoperation Node
Open a new terminal from Remote PC with Ctrl
+ Alt
+ T
and run the teleoperation node from the Remote PC.
Please use the proper keyword among burger
, waffle
, waffle_pi
for the TURTLEBOT3_MODEL
parameter.
[Remote PC]
$ export TURTLEBOT3_MODEL=burger
$ roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
Control Your TurtleBot3!
---------------------------
Moving around:
w
a s d
x
w/x : increase/decrease linear velocity
a/d : increase/decrease angular velocity
space key, s : force stop
CTRL-C to quit
Save Map
When the map is created successfully, open a new terminal from Remote PC with Ctrl
+ Alt
+ T
and save the map.
[Remote PC]
$ rosrun map_server map_saver -f ~/map
The saved map.pgm file
When SLAM in Gazebo simulator, you can select or create various environments and robot models in virtual world. Other than preparing simulation environment instead of bringing up the robot, SLAM Simulation is pretty similar to that of SLAM with the actual TurtleBot3.
The following instructions require prerequisites from the previous sections, so please review to the Simulation section first.
Launch Simulation World
Three Gazebo environments are prepared, but for creating a map with SLAM, it is recommended to use either TurtleBot3 World or TurtleBot3 House.
Use one of the following commands to load the Gazebo environment.
In this instruction, TurtleBot3 World will be used.
Please use the proper keyword among burger
, waffle
, waffle_pi
for the TURTLEBOT3_MODEL
parameter.
$ export TURTLEBOT3_MODEL=burger
$ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
Read more about How to load TurtleBot3 House
$ export TURTLEBOT3_MODEL=burger
$ ros2 launch turtlebot3_gazebo turtlebot3_house.launch.py
Run SLAM Node
Open a new terminal from Remote PC with Ctrl
+ Alt
+ T
and run the SLAM node. Cartographer SLAM method is used by default.
$ export TURTLEBOT3_MODEL=burger
$ ros2 launch turtlebot3_cartographer cartographer.launch.py use_sim_time:=True
Run Teleoperation Node
Open a new terminal from Remote PC with Ctrl
+ Alt
+ T
and run the teleoperation node from the Remote PC.
$ export TURTLEBOT3_MODEL=burger
$ ros2 run turtlebot3_teleop teleop_keyboard
Control Your TurtleBot3!
---------------------------
Moving around:
w
a s d
x
w/x : increase/decrease linear velocity
a/d : increase/decrease angular velocity
space key, s : force stop
CTRL-C to quit
Save Map
When the map is created successfully, open a new terminal from Remote PC with Ctrl
+ Alt
+ T
and save the map.
$ ros2 run nav2_map_server map_saver_cli -f ~/map
The saved map.pgm file