[go: nahoru, domu]

Skip to content

Docker scripts for building and running a SITL environment for GISNav development and testing.

License

Notifications You must be signed in to change notification settings

hmakelin/gisnav-docker

Repository files navigation

GISNav Docker Scripts

This repository provides Docker scripts for building portable SITL development, testing and demonstration environments for GISNav. The docker-compose.yaml file defines the following services:

Service name Description
sitl SITL simulation environment: PX4/ArduPilot, Gazebo and QGroundcontrol, GISNav optional (see overrides).
mapserver WMS server with embedded NAIP and OSM Buildings data covering KSQL airport.
mapproxy WMS proxy for existing remote tile-based imagery endpoint. Alternative for mapserver when imagery layer needs to cover multiple flight regions (over presumedly multiple test scenarios covering too large an area to host locally).

Quick Start

Follow these instructions to build the Docker images that are needed to run the mock GPS demo.

Setup

If you have an NVIDIA GPU on your host machine, make sure you have NVIDIA Container Toolkit installed.

Clone this repository and change to its root directory:

cd $HOME
git clone https://github.com/hmakelin/gisnav-docker.git
cd gisnav-docker

Run

Option 1: Run the SITL simulation with locally hosted maps:

docker-compose up -d mapserver sitl

Option 2: Run the SITL simulation with a WMS proxy:

Note Replace the example MAPPROXY_TILE_URL string below with your own tile-based endpoint url (e.g. WMTS). See MapProxy configuration examples for more information on how to format the string.

docker-compose build \
  --build-arg MAPPROXY_TILE_URL="https://<your-map-server-url>/tiles/%(z)s/%(y)s/%(x)s" \
  mapproxy
docker-compose up mapproxy sitl

Shutdown

docker-compose down

Overrides

To launch the SITL simulation with ArduPilot instead of PX4, use the docker-compose.ardupilot.yaml overrides:

docker-compose -f docker-compose.yaml -f docker-compose.ardupilot.yaml up -d sitl

To build the sitl image without GISNav (for use in e.g. automated testing where GISNav is installed by a CI pipeline), use the docker-compose.dev.yaml overrides:

docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml build -d sitl

Troubleshooting

Prebuilt Docker images

The versions of the dependencies of the Docker script are currently not fixed, and many of them are under active development. The script may therefore break and make building the images challenging. You can try out these pre-built images for the mock GPS demo:

Expose xhost

If the Gazebo and QGroundControl windows do not appear on your screen soon after running your container you may need to expose your xhost to your Docker container as described in the ROS GUI Tutorial:

export containerId=$(docker ps -l -q)
xhost +local:$(docker inspect --format='{{ .Config.Hostname }}' $containerId)

Set ROS_DOMAIN_ID

If you do not seem to be receiving any telemetry from the container to your host's ROS 2 node, ensure the ROS_DOMAIN_ID environment variable on your host matches the container's (0 by default):

export ROS_DOMAIN_ID=0

Run in headless mode

If you are doing automated testing (e.g. with mavsdk), you can run Gazebo in headless mode and not launch QGroundControl by setting GAZEBO_HEADLESS=1 and LAUNCH_QGC=0:

GAZEBO_HEADLESS=1 LAUNCH_QGC=0 docker-compose up -d mapserver sitl

Run shell inside container

If you need to do debugging on sitl, you can use the following command to run bash inside the container:

docker run -it \
  --env="DISPLAY" \
  --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
  --volume "/dev/shm:/dev/shm" \
  --volume="/dev/dri:/dev/dri" \
  --gpus all \
  --tty \
  --network host \
  --entrypoint="/bin/bash" \
  gisnav-docker_sitl

Disable Fast DDS on host

[RTPS_TRANSPORT_SHM Error] Failed init_port fastrtps_port7412: open_and_lock_file failed -> Function open_port_internal

If you are not able to establish ROS communication between the container and the host when using the docker-compose.dev.yaml override and receive the above error, try disabling Fast DDS on your host. You can do so by creating an XML configuration (e.g. disable_fastrtps.xml) as described in this comment and restarting ROS 2 daemon with the new configuration:

export FASTRTPS_DEFAULT_PROFILES_FILE=$PWD/disable_fastrtps.xml
ros2 daemon stop
ros2 daemon start

Repository Structure

This repository is structured as follows:

.
├── docker
│   ├── mapproxy
│   │    └── Dockerfile                     # Dockerfile for a standalone MapProxy server
│   └── sitl
│        └── Dockerfile                     # Dockerfile for the Gazebo simulation & dependencies
├── docker-compose.ardupilot.yaml           # docker-compose ArduPilot entrypoint override
├── docker-compose.dev.yaml                 # docker-compose sitl-dev build target
├── docker-compose.yaml                     # docker-compose base configuration
├── flight_plans
│    ├── ksql_airport_ardupilot.plan        # Sample flight plan for ArduPilot SITL
│    └── ksql_airport.plan                  # Sample flight plan for PX4 SITL
├── LICENSE.md
├── mapfiles
│    └── wms.map                            # Mapfile for setting up WMS on MapServer
├── mapproxy
│    └── mapproxy.yaml                      # Configuration file used by mapproxy
├── README.md
├── scripts
│    └── configure_urtps_bridge_topics.py   # Configuration script used by PX4 sitl image
│    └── Makefile                           # Makefile used by SITL images
│    └── setup_mapserver.sh                 # Configuration script used by mapserver
└── yaml
    ├── camera_calibration.yaml             # Configuration file used by PX4 sitl image
    └── gscam_params.yaml                   # Configuration file used by PX4 sitl image

8 directories, 16 files

License

This software is released under the MIT license. See the LICENSE.md file for more information.