๐งช MICKY Simulation
This section guides you through running the MICKY simulation environment using Gazebo and ROS 2.
Step 1 โ Launch Gazebo
Opens Gazebo Harmonic with the
turtlebot3_worldworld and spawns the Micky robot.
ros2 launch micky_simulation gazebo.launch.py
Wait until Gazebo GUI is fully open and the robot model is visible in the scene.
Step 2 โ Launch SLAM
In a new terminal, start the SLAM node and RViz:
ros2 launch micky_slam sim_slam.launch.py
RViz will open with the /map topic displayed. The map starts empty and is built as the robot moves.
Step 3 โ Drive the Robot (Teleop)
In a third terminal, start the keyboard teleop:
ros2 run teleop_twist_keyboard teleop_twist_keyboard
Key |
Action |
|---|---|
|
Forward / backward |
|
Strafe left / right |
|
Rotate left / right |
|
Stop |
|
Increase / decrease linear speed |
Drive the robot around the entire environment. The map in RViz fills in as new areas are scanned. For best results, make at least one full loop so slam_toolbox can close the loop.
The robot can be vizualized and controled with teleop, like the image below:
Step 4 โ Save the Map
Once the environment is fully mapped, run in any terminal:
ros2 run nav2_map_server map_saver_cli -f ~/micky_map
This generates two files:
~/your_map.pgmโ the occupancy grid image~/your_map.yamlโ metadata (resolution, origin, thresholds)
Common Troubleshooting
Gazebo does not open / freezes on startup
pkill -f gz_sim && pkill -f gzserver
unset IGN_PARTITION GZ_PARTITION
Then re-run Step 1.
Map stays empty in RViz
Check that the LiDAR is publishing:
ros2 topic echo /laser_scan_front # Expected: ~10 Hz
Move the robot โ slam_toolbox only registers a new scan after the robot travels at least 0.5 m.
Robot does not move
# Test the command manually
ros2 topic pub /cmd_vel geometry_msgs/msg/Twist \
"{linear: {x: 0.2, y: 0.0, z: 0.0}, angular: {z: 0.0}}" --once
If the robot moves in Gazebo but not from teleop, make sure the teleop terminal has focus (keyboard input is captured there).