Magic Lantern Forum

Developing Magic Lantern => Modules Development => Topic started by: Maqs on March 27, 2014, 02:19:26 PM

Title: [6D] GPS / experimental module (update: 6D.116 support)
Post by: Maqs on March 27, 2014, 02:19:26 PM
Hello,

I did a bit of GPS reverse engineering, resulting in the following experimental module that makes GPS accessible:

(https://www.magiclantern.fm/forum/proxy.php?request=https%3A%2F%2Fdl.dropboxusercontent.com%2Fu%2F11244516%2FML%2Fgpsinfo.jpg&hash=ae35a50454cc4e1151c5f099904618c7)

Module: gpsinfo.mo (https://dl.dropboxusercontent.com/u/11244516/ML/gpsinfo.mo)
Source: gpsinfo.zip (https://dl.dropboxusercontent.com/u/11244516/ML/gpsinfo.zip)

The compiled version only works for 6D.113 and 6D.116, but may work with any camera that supports built-in or external GPS. See source code (gpsinfo.c) for more information. I had to redefine both _prop_request_change and _prop_cleanup, as they are not exported and the ML core wrappers available do not work for that purpose. Therefore, the module refuses to run on other cameras/firmware versions.

The more adventurous among you with other cameras may try to point the two functions to the respective functions in your firmware, add is_camera("<your camera>", "<your firmware version>"), rebuild the module and run it at your own risk. Remember: your camera may blow up, come to life or other strange things.

You need to press set on one of the informational entries to update stuff, although the data will only be updated every "GPS refresh interval" internally in the hardware responsible. The GPS related properties I found are in gpsinfo.h.

Best,
Marcus

PS: I just wanted to share what I've done so far. Feel free to improve stuff, ask questions etc.
PSS: The module is now called "gpsinfo.mo", as objects with the same name as core objects will result in modules without any symbols being built.
Title: Re: [6D] GPS / experimental module
Post by: a1ex on March 27, 2014, 02:55:54 PM
Nice findings!

This actually gave me an idea for how to register module-only properties (so you will not have to redefine the property stubs). Current implementation of re-registering all core properties had the side effect of re-triggering the handlers without the values being changes (which resulted in subtle bugs like microphone notifications popping when loading the modules), but registering a second set of module-only properties should be fine.
Title: Re: [6D] GPS / experimental module
Post by: Audionut on March 28, 2014, 04:55:56 AM
Bumping this into the module section for increased exposure.
Title: Re: [6D] GPS / experimental module
Post by: Marsu42 on March 28, 2014, 07:23:29 AM
PS: I just wanted to share what I've done so far. Feel free to improve stuff, ask questions etc.

Great you're on it :-) ... I hope we can get some basic gps tracking with that, i.e. save the current position and then be guided back ("car finder mode")!

Fyi, here are some other gps-releated ideas if you didn't see them: http://www.magiclantern.fm/forum/index.php?topic=10663.0 (basically 1. complete geocaching mode and 2. gps power save = lengthen interval on camera idle)
Title: Re: [6D] GPS / experimental module
Post by: Maqs on March 28, 2014, 08:17:16 AM
Great you're on it :-) ... I hope we can get some basic gps tracking with that, i.e. save the current position and then be guided back ("car finder mode")!

Fyi, here are some other gps-releated ideas if you didn't see them: http://www.magiclantern.fm/forum/index.php?topic=10663.0 (basically 1. complete geocaching mode and 2. gps power save = lengthen interval on camera idle)

To 2.: I've included a 10 min./30 min. option in the menu. The Canon menu still works (aka does not crash), but does not highlight a value.

As far as I can see, we do not get any directional data, although there are props for something called GPS_COMPAS (sic!), too:

There is
Code: [Select]
#define PROP_GPS_COMPAS 0x80030053
#define PROP_GPS_COMPAS_REQUEST 0x8003005A
#define PROP_GPS_COMPAS_SELECT 0x80040043

PROP_GPS_COMPAS should contain the data (in case it's available on the 6D and once we know how to trigger it), PROP_GPS_COMPAS_REQUEST should be used to request it and PROP_GPS_COMPAS_SELECT is used from some GUI function "SetGPSCompassToStorage". There is no "SetGPSCompassToWinSystem" however, like it is for most other things ("SetSateliteStatusToWinSystem", "SetGPSSelectToWinsystem", ...).

It should be possible to compute directional data for moving cameras though...  ;)
Title: Re: [6D] GPS / experimental module
Post by: Marsu42 on March 28, 2014, 01:20:41 PM
Concerning the power save: My idea was a smoother transition from the fastest logging interval when the camera is in active use to the slowest one over time. I didn't know how much power this really saves though and if this option is "worth it".

As far as I can see, we do not get any directional data, although there are props for something called GPS_COMPAS (sic!), too

This is for the external gps unit that has a compass to log in which direction you're pointing the camera - good ol' Canon chose to cut that feature from the 6d...

... what I was talking about with "direction" is the difference between two sets of gps coordinates, i.e. the said "car finder mode". I don't have a clue about geo calculations, but alex wrote it would be easy to get some result like "1500m NW".

With the 6d lacking a compass you of course need to know where NW is yourself or as you wrote (and like my dedicated gps tracker does) let the 6D calculate the direction you're moving from the diff of the last two coordinate sets.
Title: Re: [6D] GPS / experimental module
Post by: Michael Zöller on March 28, 2014, 02:14:32 PM
Any chance we can read out GPS time? :)
Quote
GPS time is theoretically accurate to about 14 nanoseconds. However, most receivers lose accuracy in the interpretation of the signals and are only accurate to 100 nanoseconds.
Title: Re: [6D] GPS / experimental module
Post by: Pelican on March 28, 2014, 03:27:09 PM
Any chance we can read out GPS time? :)

I see a date/time on the first pic and I guess that is from the GPS. Also there is Set time from GPS probably means the same.
(https://www.magiclantern.fm/forum/proxy.php?request=https%3A%2F%2Fdl.dropboxusercontent.com%2Fu%2F11244516%2Fgps.jpg&hash=630b7cbacc655f077ed6afe16eea64ef)
Title: Re: [6D] GPS / experimental module
Post by: Maqs on March 28, 2014, 06:17:58 PM
We can read out the time, but it's not that accurate. The hardware interfacing the GPS unit is updating the data every x seconds (as set in the respective property), but does not tell us anything unless we ask for it every time. The original firmware uses a timer to query the property every x seconds. But there is a feature to automatically update the system time from GPS already in the Canon firmware. This may use other props, but I still don't know if it would me more accurate.

There are still some other/unknown fields in the 128-byte long PROP_GPS_INFORMATION property.
Title: Re: [6D] GPS / experimental module
Post by: walterono on June 22, 2014, 03:22:08 PM
hi
I'm a newbie, pls forgive my ignorance ...
1. Does the GPS module have a provision for turning the GPS off when the camera is turned off and will it work with the latest firmware (114)? Because I didn't see it in the screenshot.
2. On the home page the 6D is listed as one of the supported cameras, but on the download page for stable version 2.3 it isn't. What gives?
3. Assuming there is a build I can download for my 6D, would I download that and the GPS module as well?
Title: Re: [6D] GPS / experimental module
Post by: Frankman on June 24, 2014, 10:58:46 PM
How can I get the "GPS.mo" work on my Canon EOS 1100d ?
When I load the Module in the latest Nightly Build, I get the error message " only for 6D".

Did somebody compile it for 1100D ?

(I want to try it with Solmeta Geotagger Pro2 EOS.)

Regards
Frank