Shop OBEX P1 Docs P2 Docs Learn Events
Gps alarm — Parallax Forums

Gps alarm

I have a custom boe-bot running a propeller + gps and would like to set a proximity alarm function. This would be essentially a radius the robot would monitor. Imagine the robot sitting in a parking lot. it Takes a GPS reading and calculates if it's inside the radius of a circle. If someone moves the robot day 100 feet it sounds an alarm.

My problem is the geometry and lack of knowledge to even Google for help.

As I understand it latitude and longitude are units of minutes and seconds. I also understand earth is not a sphere so I can't simply use the Pythagorean theorem. I can't figure out how many seconds make a foot as an example.

Please point me in the right direction as I'd like to make this function as accurate as possible.

Comments

  • This link might help: movable-type.co.uk/scripts/latlong.html

    good luck with your project.
  • JasonDorieJasonDorie Posts: 1,930
    edited 2016-08-30 23:04
    If you treat it as a sphere things aren't too bad. Lat & long are in degrees, minutes and seconds are 60ths and (60*60)ths of a degree. Earth has a radius of about 6.371 million meters.

    From there it's relatively simple: The circumference of a circle is 2*PI * Radius, where 2*PI is a full circle. You want to know the arc length of a portion of that circle. For one arc-second it'd be 2*PI*Radius / (360 * 60 * 60).

    Expanded out: 2 * PI * 6,371,000 / (360 * 3600) = ~30.89m per arc-second.
    That'd mean 1/10th of an arc-second is about 3m, and 1/100th is pretty close to a foot.

    It's also worth mentioning that latitude changes always mean the same thing, but further away from the equator, a change in longitude is a smaller distance than it is at the equator. (if you're 1m away from the north pole, a 180 degree longitude change moves you exactly 2 meters).

    The math to figure out the arc-length between two points on a sphere is a little more challenging, and if you start worrying about the fact that it's not a perfect sphere, things get ugly. You could also get *really* picky and factor in altitude - The radius value is only precise at sea level - at higher altitude a change in angle moves you farther.

    Jason
  • For short distances, you don't even need to think about spheres. Any small piece of a sphere is flat enough to be treated as a plane.

    -Phil
  • Yeah, I'm with Phil on this, and in fact I'd go even farther: If you assume your bot is within, say 45 degrees of the equator, and just treat Lat/Long as X/Y coords in a rectangle, the amount of error you'd have in a 100 foot move is pretty negligible, and quite probably within the error range of the GPS itself. You should be able to work out the worst case error and decide if it's reasonable for your use.
  • Why the project? Porch pirate issues?
  • Thanks for getting back so quickly everyone.
    Phil how short would sorry be? I'm thinking that the radius could be 1/2 mile at some point but currently it's going to be less than 300'.

    The robot is a prototype built on the boe-bot to go to my local grocery store and pick up packages be delivered back home.

    The GPS with lidar and the others sensors is making this possible. Obviously boe bot chassis is to small so I'm looking into battery powered wheelchairs for a future chassis.

    It speaks, predicts weather, almost balances on two wheels, and makes a great security guard thus far.
  • Even a ten-mile radius can be treated as a plane for most practical purposes.

    -Phil
  • My personal experience with GPS modules is that they are not really usable for navigation of small robots.

    They work fine in cars because cars are usually on a street and the software of the GPS unit will correct the raw position data to match the real position.

    But just with raw data and without street maps the precision is simple not there to navigate. Even standing still the raw GPS data tends to move around quite a lot. So +-15 feet is the best you can get.

    I even tried with 2 GPS units, one mobile the other stationary to use the difference between both units. Sadly without a usable result.

    Mike
  • PublisonPublison Posts: 12,366
    edited 2016-09-01 18:44
    Depending on the model of GPS, a stationary robot will have less accuracy than one moving.

    Here is a post from PhiPi on the subject:

    http://forums.parallax.com/discussion/157351/question-about-pmb-648-gps
  • rjo__rjo__ Posts: 2,114
    edited 2016-09-02 18:54
    You can use absolute coordinates. What I have done and works for me is to go into Google Earth... put my base coordinates in and then look around the neighborhood and find the min and max for latitude and longitude.

    If you need relative coordinates, you can go back to Google Earth and poke around to find the distance that you want, and then look at the differences between the gps locations and use those differences for your relative terms.

    The unit I am using is a combo gsm/gps Sim808. How much confidence you can have in readings from this unit is indicated in by dilution of precision statistics, where the lower the number... the more accurate the reading. Among a series of readings from a static location, the ones with the lowest DOP numbers are the best.... When I use the DOP's and filter through a series of readings from a static location, with DOP's in the range of .9->1.2, I see generally less than a few meters error even though my GPS is sitting back from a window and the number of satellites in view is generally less than 10.
  • My plan....

    Im going to use the advice given here as best I understand it as follows.

    The calculation equation is :

    (a-x)^2 + (b-y) ^2 = c^2

    Im going to use Phils advice (he must be one of these - "The earth is flat guys." :P) and simply treat the earth as flat.

    With any luck Ill get this alarm function to work.
  • msrobots wrote: »
    My personal experience with GPS modules is that they are not really usable for navigation of small robots.

    They work fine in cars because cars are usually on a street and the software of the GPS unit will correct the raw position data to match the real position.

    But just with raw data and without street maps the precision is simple not there to navigate. Even standing still the raw GPS data tends to move around quite a lot. So +-15 feet is the best you can get.

    I even tried with 2 GPS units, one mobile the other stationary to use the difference between both units. Sadly without a usable result.

    Mike

    I second Mike's comment. My Google Earth logger, even when not moving, will log points that vary by 10-20 feet. Another issue is that it appears (but I haven't verified) is that the GPS seems to take into account the current velocity and direction. This causes the logged coordinates to be off by as much as 100 feet when I turn. Of course, I doubt your robot will be travelling at 60 mph :)

    Walter
  • I am only using "GPS" for a radius alarm at the moment. Its working fantastically so far but needs more data to make a conclusion. And thanks for the help people its going good thus far.

    Also I cant believe some are suggesting that I am wasting my time? Or warning me about GPS - :)

    My goal is as follows and I believe all robots need a purpose. :)

    Lidar is used in conjunction with sonar, IR and other proximity sensors to navigate its way to the local store to pick up food.

    I have a small boe-bot that is trying to get to the store but its little wheels and chassis only allow it to get out the front door down the sidewalk until it gets stuck on a crack in the pavement. I still need a more robust chassis to get this project moving.

Sign In or Register to comment.