Saturday, February 23, 2013

Another test video

Here is another video taken during testing. Not much to say really. It has a loop where it goes from 0, 60, -60, 0, 30, -30, 0 degrees in 5 second intervals. As seen in the video it is rock solid! Unfortunately I don't have a video when we are striking it with disturbances but, suffice to say, it handles it without any problems. Some offset can be seen after a few movements, this comes from one engine being a bit broken and thus creating a lot of vibrations. This causes some offset in the filter.


As soon as I know if my article was accepted to ECC -13 I will post more theory on the controller with simulation and experimental results. So stay tuned for more info!

Wednesday, February 20, 2013

First controlled test of the Quaternion controller!

Today was a big day: The first real test of the Quaternion based controller. It was some work to get it to work as expected, as an example a program to calibrate the speed controllers was needed so some time was put into that.
     After guessing the gains of the controller I started it up and it worked! As shown in the video (this is the first actual start up, none before this one) it really works! It is programmed to go from "flat" to about 60 degrees angle and it does it really well. There is a constant offset because of one of the engines being some what broken but it still works! Now it time to start tuning the controller!


Thursday, February 7, 2013

Worst bug ever! (in ST's USB CDC driver)

Today a lot has been done for the preparations to do the first controlled "flight test", "flight test" as in a Quadrotor strapped to a frame and trying the rate and attitude controller. However during the development of the controller I noticed a very strange thing happening (it actually started when I sent a lot of data over the USB VCP (Virtual Com Port), after some time the board just stopped doing anything. But it happened very sporadically, from within minutes to hours. But today I finally caught it with he debugger (I've been trying for two weeks)!
     The program got stuck in a function called " DCD_WriteEmptyTxFifo" - one of the USB interrupt handlers and for some reason it got in an infinite loop here. I can directly tell you all that I'm no expert in USB, I have just adapted the ST drivers to fit my purpose, so I started to wonder how I should fix this but Google is you friend. After some research I found this post where one had solved the problem! Apparently ST had a bug in the driver where they had forgotten to clear the interrupt and this was causing the infinite interrupt loop. After adding those lines of code my system stopped to hang randomly!

Now that's one good thorn out of my paw! But I must say I expected ST's drivers to work, not to have a bug like this.

Wednesday, February 6, 2013

PC Visualization Test - Rotating PCB

Not it's getting really close to start wit the "real" functions in the system. I'm currently testing the Madgwick AHRS algorithm, with success however I realized that his quaternion derivative is at fault. Firstly he uses the left hand derivative (why? fixed by changing the sign of the derivative) and secondly he uses the equation for when the angular rate is measured in the fixed frame, not in the PCB frame. This creates strange effects when rotating a lot but I changed this and the result can be seen in the following videos comparing Madgwick rotation and my fixed rotation.

Madgwick rotation:

Correct rotation:

And when using the correct derivative the following C# program was created to visualize the result using OpenTK:

Now it's really starting to come together!