X4-MaG is the first robot developped by the RT-MaG project, as the colaboration of the ISM (Marseille, France) and the GIPSA-lab (Grenoble, France) laboratories. It is a low cost open-hardware quadrotor ideal for research and academic use.
- The hardware: As shown in figure 4 , the robot is equipped with the 20-cm span Nanoframe of Flyduino, four "5030" propellers, four 3800KV motors, four 6A ESCs (Electronic Speed Controller for the motors) and a 2200mAh Lipo battery. The flight endurance is about 12-15min in normal use, the total span (including propellers) is 30cm and the weight is about 307g with the battery pack. An exhaustive list of the components and the open-hardware sources can be found here.
- Embedded sensors and computational resource available: The quadotor is equipped with three different electronic boards:
- The NanoWii performs the stabilization in manual mode and acquires the accelerometer's and rate gyro's output data provided by a tiny 6-axis inertial sensor (MPU6050). This low-level controller consists in a 8-bits ATmega32u4 running at 16MHz. It is also equipped with a 6-axis IMU (the MPU6050) with three 16-bit rate gyros (with a maximum range of ±2000°/s) and three 16-bits accelerometers (with a maximum range of ±16g).
- A rotor speed controller board controls in closed loop the rotational speed of each propeller. As a consequence, it is possible to finely control the robot thrust and then the body torques (see subsection IIIC). This controller consists of a 16-bits Microchip micro-controller (the dsPic33FJ128GP206) cadenced at 40MHz and was programmed with the MPLAB 16-Bit Device Blocks for Simulink. The thrust of each motor was controlled at 500Hz. The sources of this card (schematics, list of components, etc.) can be found here
- A Gumstix Overo AirSTORM COM is the high level controller programmed via the RT-MaG toolbox. This powerful COM features a 1GHz 32bits ARM-Cortex-A8 with 512MB of NAND memory. The Operating System is a 3.5.0 Linux patched with PREEMPT-RT. With its breakout board (Pinto-TH), it features 4 PWM outputs, 1 SPI bus (with 2 Chip Selects), 3 serial ports, 1 Wifi interface (54 MB/s), 8 GPIO and 6 10-bits ADC.
The propellers speed controller is the corner stone of the X4-MaG, it enables to:
- Finely control each rotor's rotational speed, and therefore each rotor's thrust which leads to control the body torques,
- Relay UART data between the NanoWii and the Overo by adjusting the voltage level,
- Relay the 4 PWM ouptuts from the NanoWii to the ESCs by adjusting the voltage level,
- Relay 2 PWM ouptuts of the Overo by adjusting the voltage level,
The propellers controller consists in a simple PI controller with anti-windup as shown by figure 2. As shown in this latter, control the rotor speed implies to control the rotor thrust, and therfore control directly the body torques.
The NanoWii consists in a 8-bit controller which recovers the Inertial Data (3-axis gyros and 3-axis accelerometers) and implements the manual pilot. The manual pilot allows to simply control the X4-MaG quadrotor using a classic hobbyist transmitter. If the high level controller (i.e., the Gumstix Overo) is running, the NanoWii just transmits the Inertial Data, and the Rx data (from the receiver) to the Gumstix, and receives from the Gumstix the rotor setpoints. As a conclusion, the NanoWii plays three roles:
- it controls the aircraft if manual mode is activated,
- it relays the rotor setpoints computed by the Gumtix in automatic mode,
- it takes the control of the quadrotor if the Gumstix (High level controller) does not respond for more than 100ms.
The Gumstix Overo consists in a powerfull 1GHz high controller running an embedded Linux. The high level controller consists in a simulink model which is executed in real-time on the Gumstix thanks to the RT-MaG toolbox. This high level controller can be easily programmed from Simulink to control the robot. It is ideal for accademic or reasearch use because all the data can be monitored on a ground station and the controllers parameters can be tuned in real time. This controller was for example used in our flying arena to accurately control the position of X4-MaG. The robot receives its position from a motion capture system as a position setpoint via a wifi connection and reaches the automatically the desired setpoint.