*UPDATE – I have lost interest in this project since I bought an OpenPilot CC3D and preordered a Revolution, I will leave it here for those interested.
Get the code and firmware from here.
Use this slightly better version of the MultiWii Configurator.
*Compatible with most of Timecop’s Naze32 boards.
This is a combination of many flight controller projects that would not be possible without timecop’s work on baseflight and jihlein’s baseflight plus. Thank-you for making a decent codebase and flight controller so that I could experiment with and use as a platform for my final year thesis project.
Ideas and source code have been derived from (please notify me for corrections):
- Baseflight/Baseflight Plus/Baseflight Plus Dev
- Madgwick/Mahony (AHRS)
This project attempts to improve the code quality and readability of baseflight so that it is easier to swap and use new modules. There are still many things to finish porting, many things to clean up and many things that may not work. At the moment it is flyable and most of the interfaces are working, allowing configuration by CLI or MultiWiiConf.
What still needs to be done:
Finish multiwii serial protocol– All current features are implemented, have some scaling issues with PID gains due to float conversions Fix PID scaling for modes other than rate mode This should be easy to do once dynamic PID is implemented in Multiwii GUIs– Still want dynamic PIDs
Add Spektrum support Add all LED modes– Sort of done now Write dynamic sensor detection at the moment it selects between MPU3050/ADXL345 and MPU6050 only. – Almost there, just need hardware to test Get MPU6050 hardware working…just need to fix up sensor directions and scale factors. Gimbal stabilisation Dynamic feature selection, only have ppm and failsafe at the moment Add altitude hold mode-Needs more work Add Rates/Expo
The sensors must be properly calibrated in order to get the best results.
Remember to save the configuration after calibrating.
- Gyro runtime bias (RATE MODE) is calibrated the same way Multiwii handles it.
- DISARMED, THROTTLE MIN, YAW LEFT, PITCH CENTRE
- Simply do the disarm command before taking off, while the vehicle is sitting on the ground.
- The flight controller must be still and stable
- Need to do this before every take-off for best results.
- DISARMED, THROTTLE MIN, YAW LEFT, PITCH CENTRE
- For even better results you should obtain the Gyro temperature compensation slope.
- Using the CLI invoke ‘calibrate gyro’. This process will take 15 minutes as we wait for the board to heat up. In normal use the temperature of the board will increase by a few degrees, you want the board to start ‘cold’ (it has been off for a while). The aim is to expose the board to the range of temperatures you will typically be flying in.
- You can terminate the calibration early be pressing any key.
- Accelerometer bias can be calculated with the CLI, ‘calibrate accel’ or:
- DISARMED, THROTTLE MAX, YAW MIN, PITCH MIN
- Multiwii GUI
- The flight controller needs to be the right side up, level and still.
- Magnetometer bias is calculated by rotating the board around all axis within 10 seconds of invoking with:
- Multwii GUI
- The CLI, using the command ‘calibrate mag’
- Stick commands
- DISARMED, THROTTLE MAX, YAW RIGHT, PITCH MIN
- Remember to save/write the configuration after calibrating.
Level mode, heading hold mode and headfree mode use an IMU/AHRS, Simon Madgwick’s implementation of Mahony’s DCM filter with magnetic drift compensation (optional) with modifications based on Openpilot’s estimator. If you do not have a magnetometer or cannot guarantee the magnetometer is free from magnetic distortion, set the config value ‘magDriftCompensation’ to false. In order to use level or head holding mode, all sensors must be calibrated and you must have a tuned and working ratemode.
The flight controller has a series of periodic ‘events’. If you are interested in changing the period of the events, they are initialised in main.c before the main loop. At the moment, accelerometer and gyro sampling is done in ‘idle’ time, the main attitude loop is updated at 300 HZ and the main actuator loop is updated at 300HZ. The cycle time variable is measuring the time between actuator updates. Events that are placed in the event queue first have a ‘higher priority’.
This code has been setup to compile with the Codesourcery toolchain and the provided Makefile. Invoking ‘make install’ will run stmloader, which is included in the support folder. The included version is precompiled for Mac OS X Lion, other unix users can build a version for themselves. This is a newer version of the one Timecop has provided in baseflight repository, that has been modified so that you can pass option -r to reset to bootloader. If you ever ‘brick’ the flight controller, just short the bootloader pads when applying power and use ‘make restore’
Some final points:
- Understand that this code is very beta.
- Rate mode is good, level and heading mode seem ok, work has begun on altitude.
- The default gains are a good starting point for a small->medium sized quadrotor.
- All checkbox items can be configured in a Multiwii GUI for mode selection. Modes that aren’t implemented will do nothing.