Why We Chose PX4 (vs APM) as Luci’s Default Firmware

Choosing the right flight controller for your drone is like choosing the right engine for an automobile — it can make all the difference when it comes to performance and capabilities. One of the company’s pivotal decisions was our choice to build a custom flight controller — Luci. It wasn’t an easy decision, but a necessary one given the lack of developer-friendly flight systems on the market.

We built Luci as a co-processor system — one component for low-level flight control tasks, and another to provide a Linux system for advanced app development. We envisioned Luci to be fully hackable, right down to its firmware. Because of this, we wanted to support the flight control firmware that offered the best performance and hackability for developers, which is why we went with PX4. And while we don’t officially support APM (at least not yet), Luci is fully open for firmware development if one chooses to use APM. However, we chose PX4 for good reason, and this article will walk through our rationale in choosing it over APM.

Flight Control Stack

Modern, sophisticated flight controllers share a commonality in architecture. We can divide their functionality into three distinct layers, illustrated here:

The architecture of a modern flight controller.

Layer 1: Real Time Operating System
The real time operating system is the back bone of the flight firmware, providing basic hardware abstraction and concurrency. Real time systems are critical for flight control performance and safety, as they guarantee that flight control tasks will be completed in a certain amount of time, and are essential for the safety and time-critical performance of UAVs. Luci uses a real time operating system called NuttX, which is highly expansive and configurable.

Layer 2: Middleware
The middleware is a collection of tools, drivers, and libraries that relate to flight control. It contains device drivers that handle sensors and other peripherals. It also contains flight control libraries such as RC protocols, math utilities, and control filters.

Layer 3: Flight Control
The flight control layer is the brains of the operation; this layer contains all of the command and control routines. Things like state estimation, flight control, system calibration, telemetry, motor control, and other flight control aspects reside in this layer.

On the surface level, APM seems to have a bigger community, more hardware support, and is thus generally more adopted, but the simple matter of the fact is that PX4 is far more advanced, with more modern architecture.

The PX4 Stack

  • Supports a much larger number of peripherals, including more IMU sensors, lidar, range finders, status indicators, optical flow, and motion capture units. PX4 supports the most advanced sensing peripherals for drones.
  • Contains advanced command and control functionality, including things like terrain estimation, and indoor flight correction.
  • More ubiquitous and built with advanced drone applications in mind. It can be compiled for POSIX (Linux) systems, and it can also integrate with ROS to run flight applications in a hybrid system, with some running on an underlying real-time OS, and others running on Linux using ROS to communicate.
  • Its software-in-the-loop (SITL) simulation is much more developed and matured.
  • It is also rooted in traditional drone racing or hobbyist camera applications and has complete support for them.

APM (ArduPilot) was largely developed by 3DR. It was initially developed for Arduino-based boards, hence its name: ArduPilot. APM is also the flagship firmware for 3DR’s Solo UAV. For many drone developers, APM has been their primary choice. However, as of late, APM’s development has drastically slowed down. PX4 on the other hand, is being championed by ETH Zurich as it continues to push the limits of flight control technology. If we take a look at the actual flight stack of the very popular Pixhawk, we will find that it only uses APM as the flight control layer and the PX4 for the middleware layer and underlying OS for performance reasons.

Luci firmware is derived from the the native full stack PX4. It is available and open source at https://github.com/Dronesmith-tech/Firmware. We believe this is the most progressive choice for drone developers.

Licensing

PX4 is licensed as BSD 3-clause, and APM is GPLv3.
Essentially, PX4 is proprietary compatible and freely linkable; whereas APM’s license requires your own project to be open sourced. With PX4, the modified version can be released under a different license, with acknowledgement of the original source. We have had many of our customers and users wanting to keep their firmware proprietary — PX4 gives them the freedom to choose how they distribute.

References

https://www.dronecode.org/software/flight-code

http://vschart.com/compare/bsd-3-clause/vs/gplv3