Netduino - It actually worked....

3689400634?profile=originalSurprising 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;        

}

3689400598?profile=original Cheers

Justin

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • 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.
  • 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
  • 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.
  • .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.
  • It's a well worn Skywalker
  • What fuselafe are you using now? Looks good
  • 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
  • Very nice and clean spartan setup!  :)

     

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

This reply was deleted.