Maverick FCS

Maverick FCS

Maverick is a from-scratch Flight Control System for multi-rotor and fixed-wing UAVs. It was conceived as a way to put together my experience over the last several years as a UAV researcher, and as a learning opportunity to get first-hand experience at low-level embedded system design, particularly the PCB, RTOS, and device driver levels.

In its current state, Maverick supports several remote-operated flight modes, with increasing amounts of software assistance:

  • Manual / Rate mode
  • Angle mode
  • Altitude Hold mode
  • Altitude+Position Hold mode (mulitrotor only)
  • Altitude+Heading Hold mode (fixed-wing only)
  • Altitude+Heading+Airspeed Hold mode (fixed-wing only)

Additionally, it supports two autopilot modes:

  • Waypoint Mode
  • Return-to-Launch Mode

Multi-rotor flight stabilization and navigation quality is similar to a Ardupilot or PX4 system for multirotors. A full motion-planning system is used to compute “perfect” jerk/acceleration/velocity/position curves. Fixed-wing flight stabilization is decent as well, but navigation needs an L1 controller or similar technology to achieve good flight pathing.

At the moment, Maverick is seen as a long-term research/hobby project – testbed for experimental software.

Hardware

The hardware system consists of a PCB with dual STM32H7 microprocessors: one for the flight control system, and one for the “safety switch”, which handles aircraft I/O and allows for manual takeover in the event of an FCS failure. The board also houses an IMU, barometer, and EEPROM, as well as connectivity for external sensors and communications, most of which are standard Pixhawk accessories. All digital systems on the board are working, though there are problems with its analog inputs.

Software: Safety Switch

The safety switch handles input from a pair of redundant SBUS radio links, as well as input from the flight controller. It outputs to 32 SBUS channel, 16 of which are also duplicated as PWM outputs configurable as 50 Hz servo, 400 Hz servo, 2000 Hz OneShot, or raw PWM). It has arming and disarming options, buttons, and indicator lights, allowing, for example, all motor outputs to remain undriven until an operator presses the arming switch.

The safety switch contains extensive settings similar to what one would see on an RC controller for input trims, scales, and curves, channel mixing, and output trim, curves, and limits. This system simplifies the flight controller by freeing it from having to maintain an awareness of the exact vehicle it is flying. As long as the flight controller outputs one aileron and one elevator channel, for example, the safety switch can translate those into multiple control surfaces, dual-input elevons, or any other typical aircraft layout.

Software: FCS Low-Level

Initially, the FCS and SafetySwitch software was to be based upon the ChibiOS embedded RTOS. However after developing prototype code, I was unable to get the system run with stable performance. With apologies to Giovanni, who was very responsive to my support requests, I decided to see if the STMCube environment + FreeRTOS would provide a better experience. I ended up liking the all-in-one aspect of the Cube system, where the graphical hardware configurator, text editor, and run-time on-chip debugger all coexist together. Thus the current microprocessors are multi-threaded FreeRTOS applications using the STM HAL libraries. All device drivers were written from scratch, and C++ interfaces were developed to provide a clean hand-off between the hardware support and the flight control code. Looking ahead, it would be an obvious benefit to connect the flight controller to a flight simulator, so I wanted to be sure and include the ability to “unplug” the true hardware and plug in simulated data instead.

The full-state estimator from the PX4 project was incorporated into this system. This component uses an extended Kalman filter plus knowledge of expected sensor behavior to estimate the full aircraft state: position, velocity, acceleration, rotation, airspeed, etc. It is a complex and critically important component, so I was happen to have an open-source option with massive user testing available to pull from!

Software: FCS High-Level

The flight control software was developed with a strong focus on modularization, and with keeping the flight control system simple so that its behavior could be understood with confidence. The core system is composed of Multirotor and Fixed-Wing controllers (and may eventually be extended to VTOL aircraft). Each controller uses combinations of PID, Filters, Motion Control, State Machines and control logic to stabilize and control the vehicle in some aspect of its motion:

Understanding motion planning, and learning how to incorporate it into these systems was crucial to developing a system that both moves accurately and efficiently, and maintains a clean code base. Although the underlying math of motion control is complex, it can be hidden away inside a motion control module, which can then take in velocity or position targets and emit position/velocity/acceleration/jerk targets which can be fed to PID controllers.

Testing

Does it work? In general, yes. The low-level drivers seem to be solid performers, the state estimator reports good health during all phases of flight, and all of the designed flight modes work as expected. The challenging position-controlled mode for multirotors performs excellently, combining very calm steady-state position holding with responsive movement.

(The drifting in the second video has been corrected. It was caused by an incorrect longitude-to-feet conversion.)

Next Steps

This is intended to be a hobby / long-term project. Now that the initial rush to get a flight control system up and running is complete, there are many directions the project could go in:

  • Acrobatic / specialized maneuvers
  • Machine-learning based maneuvers
  • Collaborative / multi-aircraft flight
  • VTOL aircraft support
  • Ultra stability for multi-rotors, like Betaflight
  • Complex mission planning
  • Redundant flight controllers