2

Currently I manage to get the direction degrees using below code:

d = Math.Atan2(Math.Sin(long2 - long1) * Math.Cos(lat2), _
    Math.Cos(lat1) * Math.Sin(lat2) - Math.Sin(lat1) * Math.Cos(lat2) * Math.Cos(long2 - long1))

Dim direction As Double = (RadToDeg(d) + 360.0) Mod 360

which, in my case let say I got 250.65°

I assign each of the direction values from 0 to 360 to its particular image from imageList which loaded in the pictureBox. (currently I have 36 compass images with different arrow direction, each represent 10 degrees)

When my device is pointed to the north, the arrow image is showing the correct direction, but when when I rotate the device (pointed to anywhere which is not north), the arrow image doesn't change, means it is not showing the correct direction anymore.

So my question is, is it possible to know in which direction the gps device is pointed?

Edit: I'm using Honeywell Dolphin 6000 Scanphone device

Baby
  • 5,062
  • 3
  • 30
  • 52
DnR
  • 3,487
  • 3
  • 23
  • 31

4 Answers4

2

If I am reading your question correct, it sounds like you are trying to determine a heading when your position is fixed and you are only rotating the device.

Unfortunately, what you are looking for is not possible with GPS.

Both the formula you are using and the GetPosition.Heading is a calculated heading based on sampling your current Latitude/Longitude and your previous Latitude/Longitude. So if you aren't moving in a direction (or moving extremely slowly), your current & previous Latitude/Longitude values will effectively be the same, which reduces that accuracy of the calculated heading.

The only reliable way to get a heading when your position is relatively fixed is to get a magnetic or gyroscopic compass, which some devices to have built in.

psubsee2003
  • 8,563
  • 8
  • 61
  • 79
  • exactly what I mean. I'm using _Dolphin 6000 Scanphone Honeywell_ device, and I believe it has built in _Magnetic compass_ but I just can't figure how to retrieve information from it. – DnR Mar 06 '14 at 00:33
2

The Honeywell Dolphin 6000 documentation doesn't mention a magnetometer or compass, so you're probably SOL. But, if it does have one, then you should be able to find methods to access it in the SDK

I recommend downloading and reviewing any APIs and documents that come with the SDK and look for references to the magnetometer or compass. Microsoft does not have standard APIs to access those sensors in Windows Mobile, so you will need the SDK from Honeywell to get that information.

PaulH
  • 7,759
  • 8
  • 66
  • 143
  • _"Microsoft does not have standard APIs to access those sensors in Windows Mobile"_ :- If this is true then this is good enough to ends my suffer on finding the answer!. I have the SDK from Honeywell with me, and there is no API related to magnetometer or GPS. So I guess I need a new device :( – DnR Mar 12 '14 at 03:04
1

"how to know gps device point at which direction?"

by using GPS Intermediate Driver, GetPosition.Heading will give you the current direction you are heading.

As stated in the GPS_POSITION documentation,

"flHeading
"Heading, in degrees. A heading of zero is true north."
Baby
  • 5,062
  • 3
  • 30
  • 52
  • i've tried this. but `GetPosition.Heading` value seems inaccurate not even close – DnR Mar 05 '14 at 07:40
1

You must distinguish between the direction you are moving, that is called bearing or course. And the direction you are looking or holding your device. (Think of you sitting in a bus that drives north (course = 0°), where you make a photo in direction west. heading = 270°)

A (consumer-) GPS receiver always returns only the course (or bearing), although some API unfortunatley call it heading sometimes.

To know the direction in wich you are holding your device while standing still, you have to use the magnetometer. Some modern smartphones, like iPhones or androids have that build into.

Additonal hint:
If your device has GPS, do NOT calculate the position via your or other formulas, better take the value from the GPS Api. This is much more acurate. The GPS chip does NOT only caluclate the direction by positional change, it also may use physical doppler shift.

AlexWien
  • 28,470
  • 6
  • 53
  • 83
  • so **the only way** to know the direction in wich we are holding the device while standing still, is through magnetometer? I am using [Honeywell Dolphin 6000 Scanphone](http://www.honeywellaidc.com/en-US/Pages/Product.aspx?category=hand-held-mobile-computer&cat=HSM&pid=Dolphin6000) device, but the problem now is some documentation said that it has magnetometer, some said it doesn't. I'm twisted – DnR Mar 11 '14 at 00:41