Code Monkey home page Code Monkey logo

px4-sitl_gazebo's Introduction

PX4 Gazebo Plugin Suite for MAVLink SITL and HITL

Build Status MacOS Build Tests

This is a flight simulator for rovers, boats, multirotors, VTOL, fixed wing. It uses the motor model and other pieces from the RotorS simulator, but in contrast to RotorS has no dependency on ROS. Original project: 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.

Installation

This simulator is designed to be used with the PX4 Autopilot. Please follow the official developer toolchain installation instructions: http://docs.px4.io/master/en/simulation/gazebo.html

Contributing and Testing

Please refer to the installations instructions above for normal usage and to get the development environment installed. This section covers specifics for developers interested to contribute to the simulator.

sitl_gazebo plugin dependencies

Some plugins on this packages require some specific dependencies:

  • Protobuf is required to generate custom protobuf messages to be published and subscribed between topics of different plugins;
  • Jinja 2 is used to generate some SDF models from templates;
  • Gstreamer is required for a plugin that streams video from a simulated camera.

Build sitl_gazebo

Clone the 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 --recursive https://github.com/PX4/sitl_gazebo.git

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

mkdir build

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 -j$(nproc) -l$(nproc)

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

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

Unit Tests

For building and running test an installation of 'googletest' is needed.

On Ubuntu it can be installed with:

sudo apt-get install libgtest-dev
cd /usr/src/googletest
sudo cmake . && cd googletest
sudo make -j$(nproc) -l$(nproc)
sudo cp *.a /usr/lib

On macOS it needs to be installed from source:

git clone https://github.com/google/googletest
pushd googletest
mkdir build
pushd build
cmake ..
make -j$(nproc) -l$(nproc)
make install

When writing test it’s important to be careful which API functions of Gazebo are called. As no Gazebo server is running during the tests some functions can produce undefined behaviour (e.g. segfaults).

catkin tools

With catkin, the unit tests are enabled by default.

# After setting up the catkin workspace
catkin build -j4 -l4 -DBUILD_ROS_INTERFACE=ON
cd build/mavlink_sitl_gazebo/
catkin run_tests

Plain CMake

For building the tests with plain CMake, the flag ENABLE_UNIT_TESTS needs to be provided.

mkdir build && cd build
cmake -DENABLE_UNIT_TESTS=On ..

Then build and run the tests:

make -j$(nproc) -l$(nproc)
make test

Packaging

Debian packages

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

px4-sitl_gazebo's People

Contributors

lorenzmeier avatar tsc21 avatar jaeyoung-lim avatar julianoes avatar eliatarasov avatar romanbapst avatar jgoppert avatar devbharat avatar christophtobler avatar arwagoner avatar bkueng avatar dagar avatar mrivi avatar tfoote avatar bazookajoe1900 avatar kamilritz avatar nicolaerosia avatar bozkurthan avatar ricardom17 avatar ahcorde avatar anton-matosov avatar lukaswoodtli avatar ndepal avatar lennartalff avatar iwishiwasaneagle avatar dogmaphobic avatar korotkoves avatar siddharthpatel45 avatar mortenfyhn avatar jacobschloss avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.