Skip to content

Blog

CI at ArduPilot

|624x385

At ArduPilot, we are working hard to improve our contribution flow and testing. You could have seen those last years that our Continuous Integration system was greatly improved. We are now testing building against 19 boards for 4 vehicle types (multicopters, submarines, ground and sea vehicles, plane types) in addition to the simulation testing with around 300 functionals tests and unittest !

Those allowed us to bring more change into ArduPilot with greater confidence and allowed us to track down bugs before they reach the codebase.

Nevertheless, working on a large audience open source project can be hard as the code is changing fast and the Pull Requests (code contributions) are often quickly outdated. This brings up two questions : can we still rebase our work on top of the main branch ? How much flash memory the new change will consume ?

ArduPilot is well optimised for microcontroller boards like STM32 brand, but we need to be careful on our flash requirement as we support boards with a 1MB limit.

That is why we just made a slight addition to our CI system. We now have a new rule that will try to do the rebase against the main branch for a representative set of boards : one 1MB limited, one STM32F4 based one's, one STM32H7 based one's. And we also do a binary size comparison. This allows us to directly get access to the change in flash consumption on the CI system.

|624x311

There is still more work to improve our CI and workflow system, if you want to help us, you are welcome to !

Open Source French Drone Identification

Cher·e·s dronistes français, (This news is mostly for french people, you will find english translation at the end of the post)

Vous n'êtes pas sans savoir que l'Arrêté du 27 décembre 2019 définissant les caractéristiques techniques des dispositifs de signalement électronique et lumineux des aéronefs circulant sans personne à bord va rentrer en vigueur prochainement. Cela implique que tous les drones pesant 800 grammes ou plus au décollage doivent être équipés d’un dispositif permettant de signaler électroniquement sa présence.

Ubuntu 20.04 support on ArduPilot

font-ecran-officiel-ubuntu-20-04|690x388

Hello guys,

A small news to announce you that we officially support Ubuntu 20.04 !

Ubuntu 20.04 support

Our installation script (install-prereqs-ubuntu.sh) has been heavily clean up and updated for this release without dropping support on old Ubuntu versions. You can also see that more comments and versatility have been added to be able to understand what it does and setup only the things you need. The default behavior isn't changed and will install everything. We also fix some minor configuration issues, and you should see some compilation speed up for STM target like CubeBlack or Pixhawk1 since the ccache configuration has been corrected (see my previous blog post for brief explanations https://discuss.ardupilot.org/t/speeding-up-compilation/52551)

This version won't bring anything new for ArduPilot. But you must be aware that Python2 was dropped as default python interpreter. Thus, Python3 is the default on 20.04. Hopefully, most of our tools are working on Python3, so you won't notice it.

Docker improvements

On other news, we have updated the docker image for development we provide for faster and simpler development. The image has been update to allow you to build all the firmware from Docker and use SITL. By default the graphic environment isn't installed to reduce the docker container size to the bare minimal (or close to).
You can find the instruction on how to use the docker image here : https://ardupilot.org/dev/docs/building-setup-linux.html#id1 . If you want to use only SITL for cloud stuff or swarming with docker, please use the multi-stage image building. SITL binaries only have libc as dependency allowing you to have a minimal sized container for SITL testing ! I will show you some examples next week.

The docker workflow works like that : - You build a base image on Ubuntu 18.04 (we will migrating when 20.04 will be fully tested) with all our development tools installed. You can see in the Dockerfile some new environment variables :

SKIP_AP_EXT_ENV=1 SKIP_AP_GRAPHIC_ENV=1 SKIP_AP_COV_ENV=1 SKIP_AP_GIT_CHECK=1

Those are passed to our install-prereqs-ubuntu.sh to skip installation of some packages like GUI stuff and coverage. You can still modify the variable to install them.

  • You launch the image and mount the ArduPilot git directory in the container. This allows you to have a clean image and share the same directory between your computer and the container. It also allows to be able to get back the built binary out of the docker container as you won't be able to flash your board directly from docker (I may be wrong, if a docker master wants you show use how to do it, please comments !).
  • From the docker container, you can use all waf commands and tools like sim_vehicle.py. As said previously, you don't have GUI inside this docker image so Mavproxy won't have Map and Console modules for example.

Completion improvements

Another improvement is the installation of our Bash completion system on the installation. This allow you to use TAB key to have suggestion of commands on tools like waf and sim_vehicle.py. for those that already have setup their environment, you can still look into the install script how to setup the completion, or check my blog post about completion here. By default we only install completion for Bash, for Zsh user please check the blog post or Tools/completion/completion.md for instructions.

Shell completion for Tools

https://youtu.be/UpY7SZ6FXi8 Hello friends,

What has always bother me on ArduPilot development was the lack of completion on the tools we used. Our command-line commands can be quite long and memorizing them when we aren't using them every day could be a pain.

To reduce this pain and allow newcomers to have some more help, I have made some shell completion for waf and sim_vehicle.py. For those that don't know what it is, the completion system allows you type the start of a word or command and let the system complete it, by double press TAB key ! When you use a terminal that is a very convenient feature, plenty of software have some completion.

The completion scripts are now in master branch, but they should appear on 4.x series on each vehicle soon. Otherwise, I will make some documentation to put the scripts on the system to allow completion to work on each branch.

I made completion for two shell : Bash and Zsh. Most users should be on Bash, as it is the default shell on Debian like system (like Ubuntu).

on Bash

To install the completion, you should either, source the main script on your current terminal or source the main script on your bash configuration.

Direct use

From ArduPilot root directory, simply use :

source ./Tools/completion/completion.bash
And now completion works from your terminal instance. If you close the terminal, the completion feature is removed.

Permanent use

Edit you .bashrc file, it is on your Home directory but it is a hidden file (CTRL+H on Ubuntu to reveal them). Then put at the end of the file :

source PATH_TO_ARDUPILOT_DIRECTORY/Tools/completion/completion.bash
where PATH_TO_ARDUPILOT_DIRECTORY is the path to ArduPilot directory (simple :crazy_face:)

Usage

You can now abuse of your TAB key on waf and sim_vehicle.py call ! See the video at the end.

On ZSH

Zsh don't allow live loading of completion. So you have to source the completion script in your .zshrc file. Like for Bash, you will find it hiding on your home ! Put at the end of the file :

source PATH_TO_ARDUPILOT_DIRECTORY/Tools/completion/completion.zsh
where PATH_TO_ARDUPILOT_DIRECTORY is the path to ArduPilot directory (simple :crazy_face:). Notice the difference, the extension is .zsh !

Video

I have made a simple video to show usage of completion : https://youtu.be/UpY7SZ6FXi8

Future improvements

I am not a command-line wizard so I tried my best to get a maintainable completion feature. Not all features are available yet, but most used one's are implemented. If some magician knows how to make the completion faster/better, feel free to submit a PR !

Multi systems patrol simulations

https://www.youtube.com/watch?v=YLDb-ti9bjU

Hello everyone,

I am often asked about what can be done with ArduPilot or with ROS, and my answers are always : you can do just about anything you’d like to do! ArduPilot is not just an autopilot for drones, it is also a well-grown robotic platform ! It is not the same as ROS, in the sense that ROS concentrates more on the high level tasks, whereas ArduPilot focuses on low-level vehicles control ! Both have strengths and drawbacks. And by using both, you will be able to create incredible robots !

During my PhD, I tried to focus my work on multi-robots systems, which are also known as swarms (from an academic perspective, swarms are just a special case of multi-robots systems). ROS by itself can excel for single robot design, but is difficult to use on multi-robots systems and flying robots like multi-rotors. On the other hand, ArduPilot allows to use multi-rotors more simply, and with safe behaviors.

In order to demonstrate the usefulness of multi-robots systems and be able to evaluate the global performance of the system, I set up some identical simulations with ROS and ArduPilot. The goal was to demonstrate the performance of a multi-robot system with various numbers of quadcopters, and rovers on patrolling tasks. I then simulated systems with 1 to 20 quadcopters, and 1 to 20 rovers and system with the same number of quadcopters and rovers. Those were simulated with SITL from ArduPilot, and I will detail at the end the few modifications that I made and that I am pushing into ArduPilot. The patrolling task was done with ROS. Each vehicle got a Mavros instance (that is, a ROS program that makes the bridge between ROS language and MAVLink), a simple python script that handles the patrolling behavior, and a master python script that controls the group. But that was too simple ! So I implemented 3 patrolling behavior, that are quite simple :

  • Random patrol (RANDOM). It is a decentralized algorithm. Each robot will go at a random patrolling point

  • Reactive patrol (HIGHEST). It is a centralized algorithm. When a robot arrived at his destination, it notifies the master script (like a base) and gets the next patrol point.

  • Cyclique patrol (CYCLE). It is a decentralized algorithms. At start, each robot create a patrol cycle.

For the full detail of the simulation models and hypothesis, please refer to my PhD manuscript and/or directly the code !

image|690x193

The results were those graphs for 1 hour of patrolling on this field, the number represent the patrol points : image|402x500

For copter only:

image|499x500

For rover only:

image|507x499

For rover and copter :

image|690x419 image|690x330

All on same graphs : image|494x500 image|523x500 image|524x500

You can see a video here of the patrolling : https://www.youtube.com/watch?v=YLDb-ti9bjU

I won't discuss the results here, but you should be worried by SKYNET ^^ as the group behavior outperform largely the single robot patrolling ! But what it was really interesting, it is that I could make all those simulation on my own laptop : just a i5 + 8go RAM and with simulation accelerated 10 times ! Right ! (If I find the budget to build 20 quads and 20 rovers, I would be able to confirm the simulation with the real platform)

ArduPilot allows to simulate entire fleets of robots with the same code that will be embedded and at a small cost ! That is right, for those kind of behavior, you don't need to use big simulator like Gazebo on big 32 cores servers. Simulate simply with SITL !

I don't say that you should use Gazebo or other well known robotic simulator, but when it comes to simulate only behavior without worrying about collision, SITL with excel !

All these were permitted thanks to OPEN SOURCE and numerous contributions ! PR welcome !

F.A.Q

Where is your code :

Github ardupilot https://github.com/ArduPilot/ardupilot and branch PhD on my fork https://github.com/khancyr/ardupilot/tree/PHD : I am currently getting back those changes into ardupilot master.

Modifications done : - allow to set sysid at the start of SITL (PR in master)

  • disable mavlink routing on a channel. Finally I didn’t use this, this was intend to prevent mavlink spam on a broadcast channel for the monitor. I still believe that we need a way to stop mavlink routing explicitly on some channel, as on swarm configuration, there is to much spam.

  • clear battery failsafe : I didn’t use this, I got another code that I will push to allow to refill the battery and clear the failsafe. On my code, the ROS part is monitoring the battery and decide when to go on base to change the battery.

  • disable MSG_POSITION_TARGET_GLOBAL_INT sending, as there is a bug in MAVROS. It has been reported and I need to make a fix on MAVROS.

  • Disable some stream and unused features. This won’t be push back on master.

  • Prevent switching in guided is EKF is not ready for Rover. (Need a PR)

  • disarm rover at the end of RTL : I am not sure we want this into master, maybe with a parameter.

  • correct battery estimation for rover : PR done.

ROS :

https://github.com/khancyr/patrol

I want to do the same with Gazebo :

If you need only a 3d visualization see https://github.com/khancyr/gazebo_ardu . This can be adapted to any 3D framework you want.

To use the gazebo plugin : https://github.com/khancyr/ardupilot_gazebo . Beware, the simulation of rover isn't simple yet as the ground contacts are a pain and the friction gives a hard time to make a skid steering rover.

Why use ArduPilot over PX4:

PX4 don't support rover and surface vehile like boat and sub. Moreover, the governance of ArduPilot is open whereas PX4 is money dronecode driven

I don't understand anything but the colors were nice :

Thanks you.