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;        

}

 Cheers

Justin

Views: 1743

Comment by Roman Krashanitsa on April 15, 2011 at 6:10pm

Very nice and clean spartan setup!  :)

 

So what happens if desiredAngle=+45 and currentAngle=-45 ?

Comment by Justin Wilson on April 15, 2011 at 11:19pm
Technically it should go from nose down to nose up or left roll to right roll. In practice good question. I will try it out and see if the SkyWalker uses the force or comes tumbling down.

Cheers
Justin
Comment by Hyon Lim on April 20, 2011 at 9:36pm
What fuselafe are you using now? Looks good
Comment by Justin Wilson on April 21, 2011 at 12:46am
It's a well worn Skywalker
Comment by Ritchie on April 21, 2011 at 2:00am
.netduino has always had my eye given I attempt .net regularly :D and I'm glad to see it functional. Have tried to figure out how fast it is running? As I am assuming the netduino stuff isn't as fast as the direct port manipulation of the addy no system.

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.
Comment by Justin Wilson on April 21, 2011 at 2:07am
It has a fair overhead running the .net framework and is not real time. For instance reading more than 1 or 2 rc channels is a bit flakey especially when the garbage collector kicks in. But in saying that reading an ArduImu thru serial and driving 4 servos seems to work fine.
Comment by Ritchie on April 21, 2011 at 4:29am
24-bits 384,000 times a second is quite a lot so I would love to do the processing in .net to make my life easier but it looks like it will be direct port :S
Admirable stuff though Justin well done
Comment by Justin Wilson on April 21, 2011 at 4:34am
Yeah managed code on a Netduino wont handle that at the moment but the boffins are looking at implementing some native fluff in the near future so all is not lost....
Thanks for the positive feedback - will hopefully have way points done in the near future.

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service