Skip to main content

GPS Navigation

We can run an outdoor demonstration of MAVROSPY via the outdoor.launch file. However, we need to make sure it runs on boot as we would not be able to SSH to our companion computer on the field.

To do this, we must ensure that Docker starts on boot:

$ sudo systemctl enable docker

Reboot the companion computer and check the status of docker:

$ sudo systemctl status docker

You should see Active: active (running) somewhere in the status report. CTRL+C to exit.

Docker provides restart policies to start containers on boot. We can take advantage of this by utilzing a layer on top of our MAVROSPY image which will run the demo launch file upon startup.

Build via the run_docker.sh script:

$ cd ~/mavrospy/docker/rpi/outdoor
$ bash run_docker.sh

The script will automatically start building the outdoor docker image and run it in a container. Notice how it immediatly launches the outdoor demo.

We want to keep this container running so don't close it. Power off your companion computer.

Specify Flight Pattern

You can specify the flight pattern to any of the available patterns: square, square_head, circle, circle_head, figure8, figure8_head, spiral, and spiral_head. Where _head will specify the drone to face in the direction of motion.

However, doing so will require additional steps:

Remove the outdoor MAVROSPY container and image:

$ docker container rm -f mavrospy-rpi-outdoor-container
$ docker image rm mavrospy-rpi-outdoor

Then modify the outdoor MAVROSPY Dockerfile:

$ cd ~/mavrospy/docker/rpi/outdoor
$ nano Dockerfile

The last line should look like this:

ENTRYPOINT ["/bin/bash", "-c", "source /opt/ros/noetic/setup.bash && source /home/rpi/catkin_ws/devel/setup.bash && sudo chown rpi /dev/serial0 && roslaunch mavrospy outdoor.launch"]

Modify the last part to specify the pattern:

ENTRYPOINT ["/bin/bash", "-c", "source /opt/ros/noetic/setup.bash && source /home/rpi/catkin_ws/devel/setup.bash && sudo chown rpi /dev/serial0 && roslaunch mavrospy outdoor.launch pattern:=circle"]

Rebuild via the run_docker.sh script:

$ cd ~/mavrospy/docker/rpi/outdoor
$ bash run_docker.sh

Power up your drone and switch to OFFBOARD mode to watch it fly!