Flight Software: Components

The SMACCMPilot flight software is an evolving research project. This page will attempt to give a high level overview of the various flight software components, but you may need to dig down into the source code to understand the details. If you have any questions, please send the development mailing list an email!

The system is under active development and the following details are expected to change. See future developments to get an idea where the flight software is going.

Components

Inputs

Radio Control input

The primary way to control the SMACCMPilot flight controller is using a radio control (RC) transmitter.

When the controller is armed. The four joystick channels on the RC transmitter directly control the SMACCMPilot stabilization controller. When disarmed, the joysticks have no effect, the stabilization controller set point is all zero, and all motor outputs are disabled.

For a complete description of RC transmitter setup, arming, and disarming, see the RC transmitter page.

The signal from the RC transmitter is sent over the air to an RC receiver, which communicates with SMACCMPilot using a PPM signal. The flight controller decodes the PPM signal in the hwf4 library timer driver. The decoded signal is accessed by the APM AP_HAL library and finally bridged into the SMACCMPilot Ivory/Tower application when the user input capture driver is accessed in SMACCMPilot.Flight.UserInput.Task.

Telemetry input

The SMACCMPilot flight controller accepts MAVLink protocol input over a secure communication link. MAVLink is a common protocol for communication between flight controllers and ground control stations (GCSs).

Presently, the MAVLink protocol implementation only supports:

  • Setting telemetry output stream rates
  • Writing MAVLink parameters
  • Arming and disarming the motors
  • User control input for override of RC Transmitter

You can connect to the SMACCMPilot flight controller with mavlink using an FTDI cable (or equivalent) on USART1 (broken out to the 6-pin 0.1" pitch connector on the PX4IOAR) at 57600 baud. We’ve tested SMACCMPilot’s telemetry interface with MAVProxy, a command line MAVLink client.

In flight, you should use the SMACCM-SiK radio firmware for the 3DR Radio.

For more details, see the telemetry MAVLink input handler source code in SMACCMPilot.Flight.GCS.Receive.Handlers

Outputs

Motor Control

AR Drone motor control is implemented in Ivory in the ivory-px4-hardware library. The AR Drone frame’s motors are controlled using a single UART stream from the microcontroller and a set of demultiplexing gates on the PX4IOAR. See the PX4 Project wiki and source code for more details on the PX4IOAR and AR Drone protocol.

SMACCMPilot also supports PWM motor controllers, which are standard on many hobby quadcopter platforms including the 3DR ArduCopter. PWM motor output is also implemented in Ivory, and used in the flight application when building for the px4fmu17_bare_freertos target.

Flight Mode

SMACCMPilot has support for the user to select multiple flight modes from the radio controller. These flight modes are:

  • Stabilize: RC transmitter provides manual roll, pitch, yaw, and throttle control
  • Altitude Hold: RC transmitter provides manual roll, pitch, and yaw control. Throttle is controlled automatically based on the barometer sensor, using the RC transmitter’s throttle stick to control climb rate
  • Auto: Control is the same as Altitude Hold mode, except that the user can override the RC transmitter through inputs on a gamepad over the secure MAVLink radio link.

In addition to supporting multiple control modes, motor output can be armed or disarmed from the radio controller. The arming mode is an important safety feature: When motors are armed, they can spin up at any time due to either pilot or sensor input. See the Radio control (RC) transmitter page for a description of arming and disarming the SMACCMPilot controller.

SMACCMPilot displays the current flight mode by blinking the red LED on the PX4FMU, as well as any optional lights connected to the relay port on the PX4IOAR board.

TODO: Table mapping mode, armed status to blinking

Telemetry output

TODO explain more

telemetry output: mavlink streams provided

see SMACCMPilot.Flight.GCS.Transmit.Task for implementation.

Sensors

The SMACCMPilot flight controller uses several components from the APM (ArduPilot Mega) software project. We maintain a fork of the ArduPilot software as part of the SMACCMPilot project. The fork contains a subset of the code from the the ArduPilot project, and in some cases has been modified for cleaner interaction with the rest of the SMACCMPilot software stack.

ArduPilot’s hardware and operating system abstraction, called the AP_HAL, permits us to use ArduPilot libraries as part of our platform. ArduPilot support for the STM32F4 hardware and FreeRTOS operating system is implemented in the AP_HAL_SMACCM library terms of the hwf4 library from the smaccmpilot-stm32f4 library.

We use ArduPilot’s AP_AHRS library to perform sensor fusion of the barometer, magnetometer, accelerometer, and gyroscope sensors on the PX4FMU flight controller. The result of this sensor fusion is delivered to the rest of the flight application through the apwrapper library, which wraps the C++ ArduPilot library interfaces into C code which can be imported by Ivory.

Stabilization

SMACCMPilot’s controller stabilizes a quadcopter: it uses inertial sensor feedback to control vehicle attitude, so that with no input the vehicle should maintain a constant level attitude and a constant heading.

Note that maintaining a constant level attitude is not equivelant to maintaining a constant position or a constant zero velocity. Misalignments between the flight controller and frame, disturbances such as wind and prop wash, and sensor drift will all contribute to vehicle motion even with a perfect stabilization controller. So, the pilot must control vehicle position or velocity by adjusting the attitude set point.

Altitude Hold

TODO Explain