Surprising but true - no blue screen of death and it didn't do a spiral of death into the rolling hills of Hertfordshire.
Hardware:
Netduin Mini - Code in C#
DiyDrones Mux
ArduImu v2
No fancy pid loops just some ugly code and lots of hot glue.
Since it worked well enough at bringing it all back to level flight i will try some way point fluff next.
Did i mention how ugly it was:
private static void Stabalize()
{
bool pitchUp = _pitch > 0;
bool rollRight = _roll > 0;
_elevatorServo.Degree = pitchUp ? 90 + ServoAngle(_pitch, 0) : 90 - ServoAngle(_pitch, 0);
_aileronServo.Degree = rollRight ? 90 + ServoAngle(_roll, 0) : 90 - ServoAngle(_roll, 0);
}
private static Int16 ServoAngle(double currentAngle, double desiredAngle)
{
double error = Abs(Abs(desiredAngle) - Abs(currentAngle)); if (error < 1) return 0;
if (error < 2) return 5;
if (error < 5) return 10;
if (error < 10) return 30;
if (error < 20) return 50;
if (error < 30) return 70;
return 90;
}
Justin