Skip to content

RichardChi/sitl_gazebo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gazebo for MAVLink SITL

This is a flight simulator for multirotors, VTOL and fixed wing. It uses the motor model and other pieces from the RotorS simulator, but in contrast to RotorS has no dependency on ROS. This repository is in the process of being re-integrated into RotorS, which then will support ROS and MAVLink as transport options: https://github.com/ethz-asl/rotors_simulator

If you use this simulator in academic work, please cite RotorS as per the README in the above link.

Install Gazebo Simulator

Follow instructions on the official site to install Gazebo. Mac OS users should install Gazebo 7, Linux users PGazebo 6. Failing to install the right version can render the simulation inoperational.

Protobuf

Install the protobuf library, which is used as interface to Gazebo.

Ubuntu Linux

sudo apt-get install libprotobuf-dev libprotoc-dev protobuf-compiler libeigen3-dev libgazebo6-dev

Mac OS

brew install graphviz sdformat3 protobuf eigen opencv
brew install gazebo7

Build Gazebo Plugins (all operating systems)

Clone the gazebo plugins repository to your computer. IMPORTANT: If you do not clone to ~/src/sitl_gazebo, all remaining paths in these instructions will need to be adjusted.

mkdir -p ~/src
cd src
git clone https://github.com/Dronecode/sitl_gazebo.git

Create a build folder in the top level of your repository:

mkdir Build

Next add the location of this build directory to your gazebo plugin path, e.g. add the following line to your .bashrc (Linux) or .bash_profile (Mac) file:

# Set the plugin path so Gazebo finds our model and sim
export GAZEBO_PLUGIN_PATH=${GAZEBO_PLUGIN_PATH}:$HOME/src/sitl_gazebo/Build
# Set the model path so Gazebo finds the airframes
export GAZEBO_MODEL_PATH=${GAZEBO_MODEL_PATH}:$HOME/src/sitl_gazebo/models
# Disable online model lookup since this is quite experimental and unstable
export GAZEBO_MODEL_DATABASE_URI=""

You also need to add the the root location of this repository, e.g. add the following line to your .bashrc (Linux) or .bash_profile (Mac) file:

# Set path to sitl_gazebo repository
export SITL_GAZEBO_PATH=$HOME/src/sitl_gazebo

Navigate into the build directory and invoke CMake from it:

cd ~/src/sitl_gazebo
cd Build
cmake ..

Now build the gazebo plugins by typing:

make

Install

If you wish the libraries and models to be usable anywhere on your system without specifying th paths, install as shown below.

Note: If you are using ubuntu, it is best to see the packaging section.

sudo make install

Testing

Gazebo will now launch when typing 'gazebo' on the shell:

. /usr/share/gazebo/setup.sh
. /usr/share/mavlink_sitl_gazebo/setup.sh
gazebo worlds/iris.world

Please refer to the documentation of the particular flight stack how to run it against this framework, e.g. PX4

Packaging

Deb

To create a debian package for ubuntu and install it to your system.

cd Build
cmake ..
make
rm *.deb
cpack -G DEB
sudo dpkg -i *.deb

Packages

No packages published

Languages

  • C 91.7%
  • C++ 7.4%
  • Other 0.9%