It has been too long since my last update, so here is what’s been going on. Up to my last update where I was testing under full manual control I was in a hurry to get the robot running. In that, I was successful. I got the hardware assembled, access to the hardware via the Arduino, and verified it all worked. The next big step was to develop the flight control software to keep the robot stable in flight and to be able to move where I want it to move. That is what I am working on now.
I have made a few attempts at flight, mostly tethered. There was one untethered test with unsuccessful results although I did get off the ground for the first time which I was not able to do under manual control:
The flight control algorithm approach I am using has three components:
- Position — Determines the position of the robot from the sensors.
- PID Control — Uses the current position versus the desired position to make adjustments to motors using a PID feedback control algorithm.
- Continual Learning — Measures success of PID Control to make adjustments to PID algorithm parameters.
I am approaching these components in order, with as much flight testing as I consider safe during the process to work out bugs, see how it performs, and gather data. I plan on developing a relatively simple Position algorithm so I can develop the PID Control algorithm and model the best PID algorithm parameters I am able to manually tune. Hopefully with that I will get more flight data to improve the Position algorithm and gather data for the Continual Learning algorithm. Then I will tackle the software for the Continual Learning algorithm. I don’t yet have a full plan for that, but I have many ideas on where to start.
The first challenge is simply getting accurate positional data from the accelerometer and gyroscope. First, the sensors measure different things. The accelerometer measures acceleration, which can give some indication of position by effect of the acceleration due to gravity since the acceleration due to gravity is constant. The gyroscope measures rotational velocity in degrees per second. Second, both are fairly noisy, especially with the motors going and the copter starts moving. Right now I have a very simple algorithm to combine the two sensors into a single angular offset of the pitch and roll (ignoring yaw for now) with a running average filter. I have also developed the main PID control algorithm, with some potential improvements to try once I get it running.
To tie these pieces together and to turn them into final motor adjustments, I have a series of translation steps that need to be made. First I have to translate the coordinate space of the robot, which is how the position of the robot is tracked, to the coordinate space of the motors because the motors are offset 45 degrees from the axis of the robot (called an “x” configuration quadcopter as opposed to a “t” configuration). This translates the position of the robot, through rotation matrices, to determine the position of each motor. To determine the error value to use in the PID algorithm, I use the arc-length of the offset of each motor from the zero-position (to achieve robot motion, instead of the zero-position, the offset will be from a target position which would cause the desired motion). Two error adjustments are calculated and applied oppositely to opposite motors by adding (or subtracting for the opposite motor) to a target motor speed. The target motor speed is currently determined by the receiver channel 3 value.
I am currently modelling the PID algorithm to guess at good PID algorithm parameters by feeding position changes into the algorithm and analyzing the results. More on this later.