So this is Arduino related and not really about Perl, but all the code I've been hacking on prototyping in Perl and porting to C has gotten me a lot of progress. I suppose it is Perl related to some degree, as if it wasn't for me knowing Perl and all the experience I've gained about writing C/XS, I wouldn't be here.

I have the GPS connected to my Trinket Pro on battery, with a GPS unit and a 0.96", 128x32 pixel OLED screen. I also have a button to switch between the "home" display contents, and the "return" display contents, and a button that writes to EEPROM that saves the coordinates of the current location.

The idea is that I can press the "save" button before going on a long hike, and turn the unit off. Then, if I ever get lost, I turn it back on, press the "return screen" button, and it guides me back to my starting location. Here are the screen layouts (in all cases I obscure some of the numbers as to not give out my home location :) Also, all coordinates have been shaved to 5 decimal points which is one metre. We don't need to be more precise than that, so it allowed me to shave some screen area) All of the N|W locations are generated dynamically based on whether the headings are negative or positive:

Home display. Top line is the current date and time in UTC. Second line is fixed-width north heading along with current heading (direction). Third line is fixed-width east heading, followed by the number of satellites we're currently locked onto. Fourth line is altitude, followed by current speed in KM/h.

17.06.03 21:17:16 UTC N:051.11111 H:288 W:114.11111 s:6 A:1090 S:0.00

Return screen. First line is fixed-width north point of the destination we need to return to, followed by the distance in Km. Second line is the fixed-width west point we're returning to, followed by the direction in degrees we need to travel. Third line is the fixed-width north point that we're currently located followed by our current heading in degrees, and fourth line is our fixed-width west point followed by our current speed of travel in Km/h.

N:050.95355 K:38.687 W:114.58056 D:244.96 N:051.11111 H:288.07 W:114.11111 S:0.00

I have manually saved the coordinates of a location I'm driving to tomorrow (Bragg Creek, Alberta, Canada), and am going to give it a test run on that driving distance. Later this week, I will go for a hike about 8km and test the actual intended functionality. For now, I'm just going to do code cleanup, fix up a couple of tiny things, and if it all works after my tests this week, I'll be contemplating how I want to package it, and solder everything together.

I have not converted the awesome magnetic declination code into C yet, so the direction has not been calibrated. I'll hack together that code after the unit is packaged and field ready, before my first real life tests of it.


In reply to Re: Calculate bearing between GPS coordinates by stevieb
in thread Calculate bearing between GPS coordinates by stevieb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.