Note: This tutorial assumes that you have completed the previous tutorials: ROS tutorials. |
Please ask about problems and questions regarding this tutorial on answers.gazebosim.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Installing and Starting Gazebo
Description: How to get Gazebo up and running.Tutorial Level: BEGINNER
Next Tutorial: Spawn objects in the world
Users are highly discouraged from using the documentation and tutorials for Gazebo on this page. Gazebo is now a stand alone project at gazebosim.org. See documentation there, thanks!
Installation
Install ROS and get the simulator_gazebo package by (%YOUR_ROS_DISTRO% can be { electric, fuerte, groovy`} etc.):
sudo apt-get install ros-%YOUR_ROS_DISTRO%-simulator-gazebo
Note: This does not work for the indigo distribution. Instead, try the following:
sudo apt-get install ros-indigo-simulators
Launching Gazebo
Setup ros environment variables:
source /opt/ros/%YOUR_ROS_DISTRO%/setup.bash
The standard Gazebo launch file is started using:
roslaunch gazebo_worlds empty_world.launch
Except in the case of Indigo, where the launch file is started using:
roslaunch gazebo_ros empty_world.launch
This should start the simulator and open up a GUI window that looks like this:
*see here for Box-Turtle GUI interaction keys.
If your system does not have sufficient graphics support, you can run gazebo headless.
Launch Script Explained
Looking at the gazebo_worlds/launch/empty_world.launch,
<launch> <!-- start gazebo with an empty plane --> <param name="/use_sim_time" value="true" /> <node name="gazebo" pkg="gazebo" type="gazebo" args="$(find gazebo_worlds)/worlds/empty.world" respawn="false" output="screen"/> </launch>
The script simply starts the Gazebo executable with a default world file (empty.world). The world file is where you can customize basic features of the simulator, such as physics engine parameters, ground plane textures, lighting and etc. For most users, the standard world file loaded by empty_world.launch should suffice. The ROS parameter /use_sim_time triggers ROS time to use the simulation time in the /clock ROS topic published by gazebo rather than the system wall clock time, see here for more details.
Next Tutorial: Spawn objects in the world