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
Comments
Thanks for the positive feedback - will hopefully have way points done in the near future.
Admirable stuff though Justin well done
I am waiting for parts from the US to start doing some direct manipulation with a 24-bit 384kHz ADC and ATMega2560-16AU. If you can show direct port does not have a significant advantage I'd love to do coding I'm more comfortable with.
Cheers
Justin
Very nice and clean spartan setup! :)
So what happens if desiredAngle=+45 and currentAngle=-45 ?