Marking An Area- GPS

Hi, I am part of a extra-curricular program called the genesis UAV challenge. I would like to write a program that recognizes when an R/C plane enters a circular area and then makes a servo change it's position. Could someone please help using Arduino, Processing or a mixture if both. Thankyou

Could someone please help using Arduino, Processing or a mixture if both.

While you do what?

How is the "circular area" defined?

Which GPS are you using? Are you getting good data from it? If the "circular area" is defined as a center (lat, lon) and a radius, then knowing when you are in the circular area is trivial (within the limits of accuracy of the GPS and the data).

Do you mean "cylindrical volume"?

Calculate the distance to the center of the cylinder. If that is less than the cylinder radius, you are in the cylinder.

There are lots of resources on the internet that will tell you how to calculate distance between two GPS positions.

PaulS: While you do what?

How is the "circular area" defined?

Which GPS are you using? Are you getting good data from it? If the "circular area" is defined as a center (lat, lon) and a radius, then knowing when you are in the circular area is trivial (within the limits of accuracy of the GPS and the data).

I haven't bought a GPS yet. I wanted to know if it was possible first. by circular area I mean center (lat, lon) and a radius. I think the accuracy of most of the GPS's that I have been looking at is 2m ish

Some of the GPS libraries have a "distanceTo" function.

Thankyou. Do you know any of their names? Would I be able to do something like this (below)

if(distanceTo(lat, lon) < 3)
{
//do something here
}

with the ‘distanceTo’ function?

google "arduino gps library distance".

also google "pythagorean theorem"

Floating point calculations on the Arduino are single precision only, so you can expect at best about 100 meters resolution with GPS distance calculations.

I have downloaded the tinyGPS++ library and am starting to learn about it. Can someone please help me compare the GPS's location to a fixed lat, lon location?

Have a look at the distanceBetween method of the TinyGPSPlus class - it looks pretty self-explanatory

Thankyou! That helped heaps

#include <SoftwareSerial.h>
#include <TinyGPS++.h>
TinyGPSPlus gps;

void setup() {
  Serial.begin(4800);
  pinMode(13, OUTPUT);
}

void loop() {
  if(TinyGPSPlus.distanceBetween(gps.location.lat, gps.location.lng, 48.85826, 2.294516) == 0.003);
  {
    digitalWrite(13, HIGH);
  }
}

Error messages:
sketch_jun02b.ino: In function ‘void loop()’:
sketch_jun02b:11: error: expected primary-expression before ‘.’ token
expected primary-expression before ‘.’ token

Sorry to be annoying but, I don't know what those error messages mean

"lat" and "lng" are functions, aren't they? - you have to call them.

Never, ever compare floating point values for equality.

if(TinyGPSPlus

"TinyGPSPlus" is the class, not the instance.

And lose the semicolon from the "if"

AWOL: "lat" and "lng" are functions, aren't they? - you have to call them.

Oops! the semicolon was an automatic reaction. What do you mean "call on them"?

You have to call the lat and long functions to get them to return their values, which you then pass to the distanceBetween function.

do you mean adding (): gps.location.lat(), gps.location.lng()?