New in Gazebo 1.9: the parsers for the Simulated Description Format (SDF) and the Universal Robotic Description Format (URDF) have been moved into a seperate package named SDFormat.
With the release of gazebo 2.0 version (as gazebo_current package) there are some important aspects of gazebo integration into ROS that must be read before continue.
Configure your Ubuntu repositories to allow "restricted," "universe," and "multiverse." You can follow the Ubuntu guide for instructions on doing this. (Note: These are enabled by default In Ubuntu 9.04 (Jaunty) and later.)
Setup your computer to accept software from packages.osrfoundation.org.
Ubuntu Linux 12.04 (precise)
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu precise main" > /etc/apt/sources.list.d/gazebo-latest.list'
Ubuntu Linux 12.10 (quantal)
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu quantal main" > /etc/apt/sources.list.d/gazebo-latest.list'
Ubuntu Linux 13.04 (raring)
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu raring main" > /etc/apt/sources.list.d/gazebo-latest.list'
Ubuntu Linux 13.10 (saucy)
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu saucy main" > /etc/apt/sources.list.d/gazebo-latest.list'
Retrieve and install the keys for the Gazebo repositories.
wget https://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
Update apt-get and install Gazebo.
sudo apt-get update
sudo apt-get install gazebo
Check your installation
gzserver
Note: As of Gazebo 1.9 you no longer need to setup your .bashrc to always source Gazebo's setup.sh to export necessary paths.
The first time gzserver
is executed requires the download of some models and it could take some time, please be patient. Wait until you see a message like Publicized address: ...
and then execute a gazebo client
:
gzclient
If you are interested in using Gazebo with ROS, see Installing gazeborospkgs.
Make sure you have removed the Ubuntu pre-compiled binaries before installing from source
sudo apt-get remove gazebo gazebo-prerelease gazebo-nightly sdformat sdformat-nightly
We also recommend for ROS users that your remove older ROS versions of Gazebo:
sudo apt-get remove ros-fuerte-simulator-gazebo ros-groovy-simulator-gazebo
If you have previously installed from source, be sure you are installing to the same path location or that you have removed the previous installation from source version manually.
As a side note, default install locations: ; Pre-compiled Ubuntu Binaries : /usr/bin/gazebo ; Default source install : /usr/local/bin/gazebo
When building Gazebo, we recommend you do not have your /opt/ros/*/setup.sh
file sourced, as it has been seen to add the wrong libraries to the Gazebo build.
Install prerequisites. A clean Ubuntu system will need:
sudo apt-get install build-essential libtinyxml-dev libtbb-dev libxml2-dev libqt4-dev pkg-config libprotoc-dev libfreeimage-dev \
libprotobuf-dev protobuf-compiler libboost-all-dev freeglut3-dev cmake libogre-dev libtar-dev \
libcurl4-openssl-dev libcegui-mk2-dev libopenal-dev git
Bullet Support (Optional) Bullet version 2.81 is needed for this. In an Ubuntu system (precise or quantal) the OSRF repo can be used to install the proper package. Be sure to follow Step 2 in the [[1.9/install#Ubuntu_Debians |Ubuntu Debians section above]] to configure your computer to accept software from packages.osrfoundation.org
sudo apt-get update
sudo apt-get install libbullet-dev
GUI test Support (Optional) To correctly parse the results of GUI regression tests, the xsltproc package is needed.
sudo apt-get install xsltproc
To install from source, you should first install the SDFormat package, then build Gazebo off of that:
Clone the repository into a directory in your home folder:
mkdir ~/gazebo_source
cd ~/gazebo_source/
git clone https://github.com/osrf/sdformat
Change directory into the sdformat repository and switch to the 1.4 branch
cd sdformat
git checkout sdf_1.4
Note: the default
branch is the development branch where you'll find the bleeding edge code, your cloned repository should be on this branch by default but we recommend you switch to the 1.4 branch if you desire more stability
Create a build directory and go there
mkdir build
cd build
Build and install
cmake ../
make -j4
sudo make install
Clone the repository into a directory in your home folder:
cd ~/gazebo_source/
git clone https://github.com/osrf/gazebo
Change directory in the Gazebo repository and switch to the 1.9 branch
cd gazebo
git checkout gazebo_1.9
Note: the default
branch is the development branch where you'll find the bleeding edge code, your cloned repository should be on this branch by default but we recommend you switch to the 1.9 branch if you desire more stability
Create a build directory and go there
mkdir build
cd build
Configure Gazebo (choose either method a
or b
below)
a. Release mode: This will generate optimized code, but will not have debug symbols. Use this mode if you don't need to use GDB.
cmake ../
Note: A big part of the compilation is the test suite. If it is useful to temporary disable it during the development, you can use:
cmake ../ -DENABLE_TESTS_COMPILATION:BOOL=False
b. Debug mode: This will generate code with debug symbols. Gazebo will run slower, but you'll be able to use GDB.
cmake -DCMAKE_BUILD_TYPE=Debug ../
The output from cmake ../
may generate a number of errors and warnings about missing packages. You must install the missing packages that have errors and re-run cmake ../
. Make sure all the build errors are resolved before continuing (they should be there from the earlier step in which you installed prerequisites). Warnings alert of optional packages that are missing.
Make note of your install path, which is output from cmake
and should look like:
-- Install path: /home/$USER/local
You can specify the the install path on the command line by defining the CMAKEINSTALLPREFIX :
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/home/$USER/local ../
Build Gazebo
make
Note: You can decrease compile time by using more cores
make -jX
Where X is the number of cores you want to use.
Install Gazebo
sudo make install
Note: As of Gazebo 1.9 you no longer need to setup your .bashrc to always source Gazebo's setup.sh to export necessary paths.
Local Install: If you decide to install gazebo in a local directory you'll need to modify some of your PATHs
echo "export LD_LIBRARY_PATH=<install_path>/local/lib:$LD_LIBRARY_PATH" >> ~/.bashrc
echo "export PATH=<install_path>/local/bin:$PATH" >> ~/.bashrc
echo "export PKG_CONFIG_PATH=<install_path>/local/lib/pkgconfig:$PKG_CONFIG_PATH" >> ~/.bashrc
source ~/.bashrc
Now try running gazebo:
gazebo
If Gazebo runs successfully, you're done!. If Gazebo was installed to /usr/local/
and running gazebo throws an error similar to:
gazebo: error while loading shared libraries: libgazebo_common.so.1: cannot open shared object file: No such file or directory
, then /usr/local/lib
is not in load path (default behavior for Ubuntu). Run the following commands and then try running gazebo again:
echo '/usr/local/lib' | sudo tee /etc/ld.so.conf.d/gazebo.conf
sudo ldconfig
If you need to uninstall Gazebo or switch back to a debian-based install of Gazebo when you currently have installed Gazebo from source, navigate to your source code directory's build folders and run make uninstall:
cd ~/gazebo_source/gazebo/build
sudo make uninstall
cd ~/gazebo_source/sdformat/build
sudo make uninstall
Coming soon...