Ask Your Question

Revision history [back]

There's basically 3 different ways to do this:

1. Gazebo

If you want a realistic 3D simulation (e.g., if you want to build your obstacle map from simulated 3D sensors), the Gazebo simulator is the way to go. For example, here's a tutorial for the Turtlebot2:

http://wiki.ros.org/turtlebot_gazebo/Tutorials/indigo/Make%20a%20map%20and%20navigate%20with%20it

http://wiki.ros.org/turtlebot/Tutorials/indigo (Section "5. Simulation" has info on both Gazebo and Stage)

2. Stage

If all you need is a 2D simulation (as is common in navigation + slam), you can use the old but fast "stage" simulator. It's easily 1-2 orders of magnitude faster than Gazebo and really easy to set up if you have a map of the environment. See here:

http://wiki.ros.org/navigation_stage

e.g.:

sudo apt install ros-kinetic-navigation-stage
roslaunch navigation_stage move_base_gmapping_5cm.launch
# now use the "2D Nav Goal" tool in RViz

3. rosbag

Instead of a simulator, you can also record a rosbag of the sensor data from your real robot, and replay it offline to experiment with SLAM and mapping algorithms.

Pros:

  • real data from your real robot, will work 1:1 on the live robot
  • no need to set up a simulation environment for your specific robot

Cons:

  • no interactivity: obviously, the recorded robot cannot be controlled from the offline code, so rosbags are only suitable for passive code like SLAM, not active codes that want to command the robot like move_base

http://wiki.ros.org/slam_gmapping/Tutorials/MappingFromLoggedData

There's basically 3 different ways to do this:

1. Gazebo

If you want a realistic 3D simulation (e.g., if you want to build your obstacle map from simulated 3D sensors), the Gazebo simulator is the way to go. For example, here's a tutorial for the Turtlebot2:

http://wiki.ros.org/turtlebot_gazebo/Tutorials/indigo/Make%20a%20map%20and%20navigate%20with%20it

http://wiki.ros.org/turtlebot/Tutorials/indigo (Section "5. Simulation" has info on both Gazebo and Stage)

2. Stage

If all you need is a 2D simulation (as is common in navigation + slam), you can use the old but fast "stage" simulator. It's easily 1-2 orders of magnitude faster than Gazebo and really easy to set up if you have a map of the environment. See here:

http://wiki.ros.org/navigation_stage

e.g.:

sudo apt install ros-kinetic-navigation-stage
roslaunch navigation_stage move_base_gmapping_5cm.launch
# now use the "2D Nav Goal" tool in RViz

3. rosbag

Instead of a simulator, you can also record a rosbag of the sensor data from your real robot, and replay it offline to experiment with SLAM and mapping algorithms.

Pros:

  • real data from your real robot, will work 1:1 on the live robot
  • no need to set up a simulation environment for your specific robot

Cons:

  • no interactivity: obviously, the recorded robot cannot be controlled from the offline code, so rosbags are only suitable for passive code like SLAM, not active codes code that want wants to command the robot robot, like move_base

http://wiki.ros.org/slam_gmapping/Tutorials/MappingFromLoggedData