Justin Wilson's Posts (4)

Sort by

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

Read more…

GPS Boundary detection

3689375442?profile=original

One part of the Aussie Outback challenge rules dictate that the aircraft/GCS must have GPS boundary detection and if the aircraft wanders outside of this boundary then it must go into the spiral of death.

As part of my slow but sure attempt at entering the competition I have created a simple but effective solution to this part of the rules using a Ray casting algorithm and running this on a Netduino in C# (easy to convert to Arduino).


Here is the code to test if the current location falls within a polygon:

public static bool LocationInsideBoundry(Position point, Position[] boundry)

{

bool insideBoundry = false;

try

{

int j = boundry.Length - 1;

for (int i = 0; i < boundry.Length; i++)

{

if (boundry[i].Longitude < point.Longitude && boundry[j].Longitude >= point.Longitude ||

boundry[j].Longitude < point.Longitude && boundry[i].Longitude >= point.Longitude)

{

if (boundry[i].Latitude +

(point.Longitude - boundry[i].Longitude) / (boundry[j].Longitude - boundry[i].Longitude) * (boundry[j].Latitude - boundry[i].Latitude) < point.Latitude)

{

insideBoundry = !insideBoundry;

}

}

j = i;

}

}

catch (Exception)

{

return false;

}

return insideBoundry;

}

Pretty simple stuff and works a treat.

Here is a simple app in .net that shows if the current location is inside the boundary – drag the map around with the right mouse button add some points and if the location is inside the boundary then the group box background will be green – outside then red.

Hopefully it will be of some use.

Cheers
Justin

Read more…

In progress APM/UDB Mission Planner

map3.jpg

Yet another mission planner in the works, i dont personally use either AP as i am creating my own.
As part of my dabblings i am creating an offline mapping tool etc for my GCS which i though might be useful to others. It's written in C# and leverages a fair few different map sources and caches the images to disk for offline use.

Needs .net 3.5 framework to run.

Right click to drag the map.

Grab it from here http://www.exsis.co.uk/MissionPlanner.zip

- and yes it is very much a work in progress (read full of bugs and missing fluff)

Cheers

Justin

Read more…