Before launching TurtleBot 3 in Gazebo, set the environment variable for the Turtlebot 3 model you wish to use in the Gazebo simulation. Either burger
or waffle
can be selected for the model parameter:
$ export TURTLEBOT3_MODEL=burger
To start the simulation, type the following command:
$ roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch
You should see the words Advertise odom on odom!
on the screen and a screenshot similar to the following:
Now let us try a more interesting scene with objects for TurtleBot to drive around. Use Quit on the Gazebo application from the menu bar and press Ctrl + C in the terminal window to halt the process. If you close the terminal window at this point, make sure that you export the TURTLEBOT3_MODEL
variable in a new terminal window.
Now, type the following command to spawn the TurtleBot 3 model on the TurtleBot 3 world map:
$ roslaunch turtlebot3_gazebo turtlebot3_world.launch
This command should produce a screenshot similar to the following:
Notice the small black dot between the large turtle's back legs. This is TurtleBot 3! You can use the keyboard control command that was used for rviz to drive TurtleBot around the TurtleBot 3 world. Open a second terminal window and type the following command:
$ roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
The TurtleBot 3 can also run autonomously, navigating around the TurtleBot 3 world. To view this application, hit Ctrl + C in the terminal window running the keyboard teleop process, and close the window. Open a new terminal window and type the following commands:
$ export TURTLEBOT3_MODEL=burger $ roslaunch turtlebot3_gazebo turtlebot3_simulation.launch
The Gazebo window should show TurtleBot 3 actively running around the TurtleBot 3 world. Next, open another terminal window and launch rviz configured to visualize certain TurtleBot 3 published topics by typing the following commands:
$ export TURTLEBOT3_MODEL=burger $ roslaunch turtlebot3_gazebo turtlebot3_gazebo_rviz.launch
The rviz screen should look similar to the following screenshot:
In the preceding screenshot, TurtleBot is near the left wall of the TurtleBot 3 world and the red line represents the laser scan data. This laser scan visualization will be discussed in more detail in the next chapter, Chapter 4, Navigating the World with TurtleBot.
Now, we will present the real TurtleBot 3 and describe how to get the robot up and running.