Creating a compass on a non-directionally aware device

456 Views Asked by At

I need to develop a compass for a device we are using. This device is directionally unaware (no gyroscope), but has a GPS module. How can I make a compass, with a needle, that leads from a start coordinate (likely their current position) to an end coordinate?

My current thoughts are:

  1. Poll coordinates on the GPS sensor as quickly as appropriate.
  2. Record coordinates where the PDOP is within a respectable range (maybe less than 2.0).
  3. Determine the direction they are facing based on the coordinate changes of them walking.

I have a few issues with this though:

  1. Firstly, the unit has to be moved around to get a sense of where they are.
  2. Doesn't seem like it would be the most accurate, i.e. how many past points do you use to determine direction change?
  3. I'm not really sure if this is a feasible solution. Is there some implementation theory I can read on this?

Is there a better way to solve my problem? The scope of the project involves going from a 'current location' to some geo-tagged item in an oil field.

Using a Windows Mobile 6.5 device - C# on VS2008.

3

There are 3 best solutions below

0
On

If I were in your shoes, I would display a notice on the screen that tells the user to always keep the top of the device pointed in the direction of travel. While they are moving, calculate the direction they're going using their current position and their last known position. Then calculate the direction they should be moving based off of their current position and the target's position. Then calculate the difference between their direction of travel and the direction they should be traveling, and use that difference to point an arrow on the screen that shows which direction they should be going relative to their current direction.

Here's an example: Let D represent Direction of travel. Let's say that's 100 degrees in this example. Let T represent the direction they should be traveling to reach the target. Let's say that's 90 degrees in this example. T - D = -10, so draw an arrow on the screen pointing -10 degrees from straight up. Remember straight up is the same as D if they're following the instructions I mentioned earlier. This means that the arrow is pointing at D-10, which is 90 degrees, which is the way they should be going.

Now you have another problem: if they stop moving, you no longer have any way to tell which way the device is pointing. In that case, hide the arrow and let the user know that it will return once the GPS starts moving again.

The last thing to keep in mind is that a 1 degree change in latitude represents more distance than a 1 degree change in longitude, so determining your headings isn't as straightforward as you might think. Here's a link to an article that tells you how to calculate headings based on 2 GPS points: http://www.movable-type.co.uk/scripts/latlong.html

Good luck!

Edit: Most GPS devices give you the direction of travel, but unless you're using the same algorithm the GPS uses when you calculate the direction they should be going, there could be a discrepancy that would cause your arrow to be a little off.

1
On

I think the issue you have is that the way people use a compass doesn't fit with what you are achieving with a 'getting closer' technique. When you look at a compass you tend to spin to get a sense of direction, which is going to fail in your case, no matter how clever you get with distances. In fact the direction of the phone is going to be irrelevant, because it doesn't know which way up it is to be able to adjust any compass.

I think you'd be better dropping the compass idea and developing an interface that works with the 'getting closer' method you suggest. Maybe a simple distance to target display would be better? I think showing something that doesn't do what it should do is likely to be counter productive. If it was sat nav, within a moving vehicle then maybe it might work, as you can't spin that easily on the spot and it's likely to update itself before you've spun around.

Giving it some further thgouht I think using a map and showing your last movements on that with some sort of line (although the map may display upside down in relation to the users direction) would be better locating a target, if you showed a vector of your current location towards your target. At least if the vector and your movement line were aligned you'd know you were travelling in the right direction.

0
On

In your case you only can create an instrument which shows the geographical direction you are moving. This is equal (or better) then a compass when the user points the device in the direction he is moving.

This is not equal to a compass, but in some cases even more usefull: e.g inside a vehilce where a compass using the magnet field would not work well.

GPS has a "course" atribute. Just use that, and you are ready.