Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / GPS , accelerometer and magnetometer... make true north more accurate?? (android)

Author
Message
ICERGB
22
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 25th Sep 2016 08:46
It seems the GPS location seems to be very accurate, but the magnetometer (on any device really) seems to be far less than reliable...

I did manage to make a basic compass work fairly accurate...

Is there any way to make the compass more accurate? So that I can impose a 3d object in my living room say or on a roof using the camera?

I think I know how it can be done; if I could just get an more accurate positioning of true north?

I mean, its like I can almost taste it...
Or is it to complicated or just impossible?






Jeff Miller
19
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: New Jersey, USA
Posted: 25th Sep 2016 13:02
What does the output of the magnetometer represent? If it is just reporting the angle you would get from an old fashioned hand-held magnetic compass, then you have to compensate for magnetic declination, which is the angle between the magnetic field line generated by the north magnetic pole and your longitude line (direction to the geographic north pole). In Canada where you are, it can be significant, but not currently as bad as it was when I was young and the magnetic north pole was then fully a thousand miles down into Canada (on Balthurst Island I think). Using the GPS location reported is the key. However, you can't just write routine solving a spherical triangle because the magnetic field lines are not great circles. You need a database. There is supposedly some free downloadable C source code available from the National Geospatial-Intelligence Agency that ties into a magnetic declination database that is updated every five years, which might be integrated into a Tier 2 program. Give it a shot.
ICERGB
22
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 26th Sep 2016 10:15
There is several articles that claim an accelerometer could help, but they don't explain why maybe its just BS?
If I had 3 gps coordinates in my city and I could calculate the exact distance between us, this would not help?
if I could line of site the phone to a landmark perhaps?

Just throwing ideas out..

There must be an easier way?








CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 26th Sep 2016 11:29
The magnetometer is incredibly sensitive and susceptable to magnetic noise. Even standing near a metal object can skew the result. Applying a low-pass filter (take an average result over time) to the magnetometer output in order to smooth the result might help?
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
Jeff Miller
19
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: New Jersey, USA
Posted: 26th Sep 2016 12:41
Since you know that the magnetometer is off slightly from due North, check to see if the amount happens to be the magnetic declination for where you are. If so, then there are ways to solve it. You can use this map:

http://joesportsandsurplus.com/shared/media/editor/file/magnetic_declination_chart_canada_2000[1].pdf

Alternatively, your government publishes on the web an online calculator, where you just type in your GPS reading and the current year:

http://www.geomag.nrcan.gc.ca/calc/mdcal-en.php

In either case, if the amount of error you have been detecting is in fact the magnetic declination for where you are, then the magnetometer is OK and you are on the right track. If you are content to using it just for roaming around your own city, just use the magnetic declination as an offset to the reading typing it into the program. You can make it a permanent constant (for a year or so).

If you want the program to be more general so you or others can use it elsewhere, you might be able to somehow tie the GPS reading to the online calculator. Some of the other forum folks might be able to guide you regarding coordinating your app with a webpage.

The problem is when you are in the boonies with no internet access, and that is generally when you actually have a need for a compass. l In that case, you are somewhat on the right track with your theory about taking readings from multiple locations.
You don't need three. You need to take a GPS reading from a place that has some prominent feature that you will be able to see from elsewhere. Then when you are elsewhere but you can still see the feature, you take your current GPS reading.
You can calculate the direction from where you are to the feature using spherical trigonometry. Compare that with whatever bearing the device gives you from your program when you point it at the feature. The difference will be the magnetic declination, and you use that value to adjust all other readings from that location.
ICERGB
22
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 27th Sep 2016 12:02
Thanks for the extra info... Something to chew on!
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 28th Sep 2016 17:17
Google Maps doesn't know which way my phone is pointing. Also the GPS is very inaccurate. You cannot rely on a phone to get perfect orientation or location.

Login to post a reply

Server time is: 2024-11-25 01:42:52
Your offset time is: 2024-11-25 01:42:52