• Stars
    star
    368
  • Rank 115,958 (Top 3 %)
  • Language
    C++
  • Created almost 9 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Set of plugins, models and worlds to use with OSRF Gazebo Simulator in SITL and HITL.

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/main/en/sim_gazebo_classic/

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).

CUDA Hardware Accelerated H264 encoding (optional)

  1. Download CUDA 10.0 from https://developer.nvidia.com/cuda-toolkit-archive.
  2. Download Video Codec SDK 9.0 from https://developer.nvidia.com/video-codec-sdk-archive.
  3. Install both archives:
wget https://raw.githubusercontent.com/jackersson/env-setup/master/gst-nvidia-docker/install_video_codec_sdk.sh
chmod +x install_video_codec_sdk.sh
sudo ./install_video_codec_sdk.sh
sudo dpkg -i cuda-repo-ubuntu*.deb
sudo apt-key add /var/cuda-repo-<version>/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda
  1. Reboot your system and run the command nvidia-smi to verify the successul installation of CUDA.
  2. Install GStreamer 1.18.3:
git clone https://github.com/GStreamer/gst-build -b 1.18.3
cd gst-build
meson -Dbuildtype=release -Dstrip=true -Dgst-plugins-bad:introspection=enabled -Dgst-plugins-bad:nvcodec=enabled builddir
ninja -C builddir
sudo meson install -C builddir
  1. Add <useCuda>true</useCuda> to any gazebo_gst_camera_plugin in a SDF file. For example ./models/fpv_cam/fpv_cam.sdf.

catkin tools

With catkin, the unit tests are enabled by default.

# After setting up the catkin workspace
catkin build -j4 -l4 -DBUILD_ROS_PLUGINS=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

More Repositories

1

PX4-Autopilot

PX4 Autopilot Software
C++
7,009
star
2

PX4-Avoidance

PX4 avoidance ROS node for obstacle detection and avoidance.
C++
618
star
3

PX4-ECL

Estimation & Control Library for Guidance, Navigation and Control Applications
C++
473
star
4

eigen

Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.
C++
418
star
5

PX4-user_guide

PX4 User Guide
Jupyter Notebook
257
star
6

PX4-Bootloader

PX4 Bootloader for PX4FMU, PX4IO and PX4FLOW
C
236
star
7

PX4-Flow

Firmware for PX4FLOW board
C
232
star
8

sapog

Sapog - advanced multiplatform ESC firmware
C
203
star
9

PX4-Devguide

PX4 Devguide GitBook
TeX
193
star
10

flight_review

web application for flight log analysis & review
Python
191
star
11

PX4-Matrix

Lightweight, dependency free Matrix library (BSD)
C++
176
star
12

PX4-OpticalFlow

This repository contains different algorithms to calculate the optical flow. It can be used as input for a position estimator
C++
156
star
13

NuttX

Standard NuttX with current PX4 patches
C
138
star
14

pyulog

Python module & scripts for ULog files
Python
124
star
15

px4_ros_com

ROS2/ROS interface with PX4 through a Fast-RTPS bridge
C++
120
star
16

PX4-GPSDrivers

Platform independent GPS drivers
C++
84
star
17

DriverFramework

Operating system and flight stack agnostic driver framework for POSIX (Linux, NuttX, Mac OS, QNX, VxWorks).
C++
77
star
18

px4_msgs

ROS/ROS2 messages that match the uORB messages counterparts on the PX4 Firmware
CMake
69
star
19

homebrew-px4

PX4-related Homebrew formula for developers using OS X
Ruby
68
star
20

PX4-containers

Build scripts for containers running various PX4 setups, like SITL with ROS.
Makefile
64
star
21

HIL

Hardware in the loop tools for PX4 Firmware
Python
38
star
22

PX4NuttX

For Migration to new NuttX Repository layout
36
star
23

PX4-windows-toolchain

Repo containing all scripts to install and use the PX4 Toolchain for Windows.
Batchfile
31
star
24

snap_cam

This package provides tools to work with the Snapdragon Flight cameras as well as perform optical flow for use with the PX4 flight stack.
C++
27
star
25

NuttX-apps

Standard NuttX apps with current PX4 patches
C
26
star
26

PX4-gazebo-models

Model repo in app.gazebosim.org
Python
18
star
27

uvc_ros_driver

A ros node to stream images from a multi-camera UVC device
C++
18
star
28

px4ros

contains submodules for ROS SITL, used to define relations between projects/versions
17
star
29

Lepton

FLIR Lepton ROS node
C++
14
star
30

docs.px4.io

PX4 User Guide Content: See https://github.com/PX4/px4_user_guide
HTML
11
star
31

micrortps_agent

microRTPS agent side of the microRTPS bridge. Used to interface PX4 with the DDS world through FastRTPS/FastDDS.
C++
10
star
32

UAVCAN_Bootloaders

C
8
star
33

disparity_to_point_cloud

ROS Node which converts a disparity map in a point cloud
C++
8
star
34

electronWebGCS

JavaScript
7
star
35

ulog_cpp

C++ library for reading and writing ULog files
C++
7
star
36

dev.px4.io

PX4 Developer Guide Content: See https://github.com/PX4/Devguide
HTML
7
star
37

rpi_toolchain

Files for building PX4 POSIX on Raspberry Pi
Shell
5
star
38

mav_comm

This repository contains message and service definitions used for mavs. All future message definitions go in here, existing ones in other stacks should be moved here where possible.
C++
4
star
39

px4_sdk

Library to control PX4 from a companion computer using ROS 2
C++
4
star
40

PX4-Metadata-Translations

Translated metadata for https://github.com/PX4/PX4-Autopilot
Python
3
star
41

Board_ID

3
star
42

uavcan_board_ident

CMake
2
star
43

PX4-graphics

Downloadable media assets and branding guideline
2
star
44

Toolchains

PX4 build system toolchains
Shell
2
star
45

Firmware-Doxygen

PX4 Firmware Doxygen documentation
HTML
2
star
46

rddrone_uavcan

2
star
47

companion

Companion computer bringup and maintenance scripts
Shell
1
star
48

px4_msgs-release

Release repository of px4_msgs for ROS (1) distros
1
star
49

px4_msgs2-release

Release repository of px4_msgs for ROS 2 distros
1
star
50

NuttX-NxWidgets

C++
1
star
51

rfcs

Requests for Comment for PX4/Firmware
1
star