PX4 Docker Containers

    Docker containers are available that contain the complete PX4 development toolchain including Gazebo and ROS simulation:

    • px4io/px4-dev: toolchain including simulation
    • px4io/px4-dev-ros: toolchain including simulation and ROS (incl. MAVROS)

    Pull one of the tagged images if you’re after a container that just works, for instance , the latest container is usually changing a lot.

    Dockerfiles and README can be found here:

    They are build automatically on Docker Hub: https://hub.docker.com/u/px4io/

    Install Docker from here , preferably use one of the Docker-maintained package repositories to get the latest version.

    Containers are currently only supported on Linux. If you don’t have Linux you can run the container inside a virtual machine, see further down for more information. Do not use boot2docker with the default Linux image because it contains no X-Server.

    The following will run the Docker container including support for X forwarding which makes the simulation GUI available from inside the container. It also maps the directory <local_src> from your computer to <container_src> inside the container and forwards the UDP port needed to connect QGC. Please see the Docker docs for more information on volume and network port mapping.

    If everything went well you should be in a new bash shell now. Verify if everything works by running SITL for example:

    1. cd <container_src>
    2. make posix_sitl_default gazebo

    It’s possible that running Gazebo will result in a similar error message like the following:

    In that case the native graphics driver for your host system must be installed. Download the right driver and install it inside the container. For Nvidia drivers the following command should be used (otherwise the installer will see the loaded modules from the host and refuse to proceed):

    1. ./NVIDIA-DRIVER.run -a -N --ui=none --no-kernel-module

    More information on this can be found here: http://gernotklingler.com/blog/howto-get-hardware-accelerated-opengl-support-docker/

    Re-enter the container

    If you exit the container, your changes are left in this container. The above “docker run” command can only be used to create a new container. To get back into this container simply do:

    If you need multiple shells connected to the container, just open a new shell and execute that last command again.

    Any recent Linux distribution should work.

    Memory

    Use at least 4GB memory for the virtual machine.

    Compilation problems

    If compilation fails with errors like this:

    1. The bug is not reproducible, so it is likely a hardware or OS problem.

    Try disabling parallel builds.

    Allow Docker Control from the VM Host

    Edit /etc/defaults/docker and add this line:

    1. export DOCKER_HOST=tcp://<ip of your VM>:2375
    2. # run some docker command to see if it works, e.g. ps
    3. docker ps

    The ROS multiplatform containers are not maintained anymore: