Giter Site home page Giter Site logo

vibgyor-s / px4-gazebo-headless Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jonasvautherin/px4-gazebo-headless

0.0 0.0 0.0 47 KB

An unofficial Ubuntu-based container building and running PX4 SITL (Software In The Loop) through gazebo.

License: Apache License 2.0

Shell 49.65% C++ 13.25% CMake 6.30% Dockerfile 30.79%

px4-gazebo-headless's Introduction

GitHub Actions StatusDocker pullsDockerHub version

PX4-Gazebo simulator (headless)

Quickstart

The Docker images resulting from this repo are available on Docker Hub.

Note that the following commands are referring to the latest supported release of PX4, which is currently v1.14.0.

Run in BROADCAST mode:

In this mode, the simulator will be available from your host (e.g. run the following command, and QGroundControl running on your computer will connect automatically).

docker run --rm -it jonasvautherin/px4-gazebo-headless:1.14.0

In this configuration, the container will send MAVLink to the host on ports 14550 (for QGC) and 14540 (for e.g. MAVSDK).

Run with a custom IP for the second MAVLink interface

This mode is useful for running QGroundControl on the computer running docker, and the offboard app (e.g. using MAVSDK) on another device (e.g. a phone).

docker run --rm -it jonasvautherin/px4-gazebo-headless:1.14.0 192.168.0.12

where 192.168.0.12 should be replaced by the IP listening on the API port 14540 (e.g. MAVSDK or MAVROS).

Run with custom IP for both MAVLink interfaces

This mode is useful for running both QGroundControl and the offboard app (e.g. using MAVSDK) on another device than the one running docker.

docker run --rm -it jonasvautherin/px4-gazebo-headless:1.14.0 192.168.0.10 10.0.0.12

where 192.168.0.10 should be replaced by the IP listening on the QGC port 14550 (e.g. QGroundControl) and 10.0.0.12 should be replaced by the IP listening on the API port 14540 (e.g. MAVSDK or MAVROS).

Exposing a video stream

When running with the Typhoon H480 vehicle (with -v typhoon_h480), a video stream will be available. Expose it with e.g. -p 8554:8554, like so:

docker run --rm -it -p 8554:8554 jonasvautherin/px4-gazebo-headless:1.14.0 -v typhoon_h480

Run with another start location

The start location can be set when running the container by setting the following environment variables:

  • PX4_HOME_LAT: starting latitude of the drone.
  • PX4_HOME_LON: starting longitude of the drone.
  • PX4_HOME_ALT: starting altitude of the drone.

For instance:

docker run --rm -it --env PX4_HOME_LAT=47.397742 --env PX4_HOME_LON=8.545594 --env PX4_HOME_ALT=488.0 jonasvautherin/px4-gazebo-headless:1.14.0

Manual build

Note that a clean build from the master branch will pull the latest upstream from the PX4 repository (as can be seen here). In order to build a stable version, change master for a tag (e.g. v1.14.0) in the following commands.

Build the image from this git repository:

docker build https://github.com/JonasVautherin/px4-gazebo-headless.git#master -t px4-gazebo-headless

The starting location of the drone can be set at build time using build arguments (by default the drone is in Zuerich). The possible build arguments are:

  • HOME_LAT: starting latitude of the drone (defaults to 47.397742).
  • HOME_LON: starting longitude of the drone (defaults to 8.545594).
  • HOME_ALT: starting altitude of the drone (defaults to 488.0).

Build arguments can be added to the above command line as follows:

docker build https://github.com/JonasVautherin/px4-gazebo-headless.git#master --build-arg HOME_LAT=37.873350 --build-arg HOME_LON=-122.302525 --build-arg HOME_ALT=20 -t px4-gazebo-headless

Troubleshooting

I cannot build the image

Problem:

Building the image fails with the following error:

c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.

Possible solution:

If running on Docker for Mac, try to increase the memory in Preferences > Advanced > Memory. Increasing from 2GB to 4GB solved the problem for me.

If running on Docker for Windows, you can do it by right clicking on the Docker icon on the task bar and going into Settings > Resources > Advanced > Memory.

It doesn't work with Docker Toolbox

Problem:

Using Docker Toolbox (instead of Docker for Windows/Mac, for instance on Windows 10 Home), px4-gazebo-headless is not detected by QGroundControl running on the host.

Solution:

The container automatically detects if it is running inside Docker for Windows/Mac, but not if it is inside Docker Toolbox (let me know if you have a way to detect this). However, it seems that in Docker Toolbox, the host is assigned 10.0.2.2 by default (I am guessing this default is coming from VirtualBox). Therefore it works to redirect to this IP, as described above. For instance:

docker run --rm -it jonasvautherin/px4-gazebo-headless:1.14.0 10.0.2.2 10.0.2.2

It doesn't connect with Podman

Problem:

Using podman, the MAVLink traffic for port 14550 (and 14540) does not seem to arrive in QGroundControl (and MAVSDK).

Solution:

Try to use the "host network" mode and set the MAVLink interfaces for both interfaces.

podman run --rm --network host -it jonasvautherin/px4-gazebo-headless:1.14.0 127.0.0.1 127.0.0.1

px4-gazebo-headless's People

Contributors

jonasvautherin avatar julianoes avatar martijngevaert avatar sitin avatar jaeyoung-lim avatar av-jeroen avatar pjort 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.