At the moment my quad copter fly's under manual control and I'm starting to implement autonomous control. The features I hope to implement are:
- Altitude hold
- Auto take off
- Auto land
- Position hold
- Way point navigation
My University final year project starts next week so I will posting weekly updates, links to resources that I find useful and videos!
I designed, built and developed a Quad Rotor including the frame, electronics and flight control software as I thought it would be an interesting challenge and learning exercise. The software is written in C++ and runs on an on-board micro-controller called an mBed. I used the Quad Rotor in my University dissertation, developing semi-autonomous features such as an altitude controlled mode that enables the Quad Rotor to maintain an altitude, follow the contours of the ground and land automatically if the Quad Rotor loses connection with the operator remote.
I also developed an accompanying Base Station application to receive wireless telemetry data and control the Quad Rotor. This is written in C# using the WPF charting toolkit to display real time data.
The various parts of this project are covered in more detail below.
The Flight Controller electronics consist of a single circuit board containing all the necessary components and peripheral connections to input/output devices. The inputs to the electronics are shown in green, the Flight Controller software, running on an mBed, is shown in red and the outputs are shown in blue. Whilst designing the electronics prototypes a few points were considered. The most important consideration was sensor accuracy as the Quad Rotor is not able to maintain stability unless the attitude and altitude data are reliable. Another consideration was to ensure that all the components could be powered by the 5V DC supply from the battery and that the micro-processor chosen was sufficiently powerful to run the flight control algorithms at 500Hz.
The Flight Controller software runs on an mBed micro-processor contained in the Flight Controller electronics. It takes inputs from the sensors, remote control and Base Station application and uses this data to control the speed of the 4 propellers independently. This enables the Flight Controller to control the Quad Rotor and maintain stability during flight.
The Flight Controller consists of a main class and seven more encapsulated classes which handle the various tasks necessary to maintain stable flight. To enable the classes to communicate with each other dependency injection was used (shown with a dashed line). This is where each dependency class is instantiated before the dependant class and the dependency classes are passed by reference to the dependant class constructor. The dependency classes are passed by reference to ensure that the same object is used by all the dependant classes.
The Flight Controller implements a finite global state machine which makes sure that all the other components of the Flight Controller can only run valid action in the current context of the system. For example the state machine would not allow the motors to spin until the Flight Controller has been initialised, the remote control has been connected and the armed flag has been set to true.
The state machine contains 6 mutually exclusive states. Green denotes on the ground, orange denotes on the ground but armed, blue denotes flying and red denotes error.
Pre Flight: the Flight Controller starts up and immediately enters the pre flight state. Initialisation and sensor calibration is only possible in this state.
Standby: in this state the Flight Controller has been initialised and the remote control connected.
Ground Ready: in this state the Flight Controller has been armed and is ready for flight.
Manual: in this state the Flight Controller is flying in manual mode.
Stabilised: in this state the Flight Controller is flying in altitude hold mode.
Error: in this state an error has occurred. The motors are disabled...Read more »