Skip to content

LennartG-Sve/GPS-Odometer_pi

Repository files navigation

GPS Odometer

The GPS Odometer is a plugin for OpenCPN version 5.0 and higher. It is a simple odometer with these basic functions:

An optional Speedometer with both analog and digital readout.
A Total Distance log, always displayed.
A Trip Distance log, always displayed.
An optional Deparure / Arrival timer with digital readout
A Trip reset button that resets Trip, Departure Time and Arrival Time
An optional Leg Trip time and Distance including a Leg reset button

The instruments are shown in the above listed order. It is not possible to change the order, only to toggle the optional instruments on and off. The instruments for Total distance, Trip distance plus the Trip reset button can not be toggled off.

The plugin is based on the OpenCPN dashboard plugin as modified by Steven Adler and the idea is to make a GPS based Odometer that is as straight-forward as possible. It has a minimum of bells and whistles to allow for easy use and a minimum of handling. Just leave the GPS Odometer on screen and reset the trip counter once the trip is ended (and log written?) or before the new trip starts.

The trip will be considered started as soon as the speed increases above 'Minimum Route Speed', preset to two knots. The date and time will be displayed on the instrument as the upper value for 'Departure & Arrival' times. The trip will be considered stopped as soon as the speed decreases below 'Minimum Route Speed' and the date and time will be displayed on the instrument as the lower value for 'Departure & Arrival' times. If the speed then again increases above 'Minimum Route Speed' the trip be either continued or restarted depending on if the 'Trip reset' button has been clicked or not. You may even shut down OpenCPN for e.g. a lunch break, the 'Trip distance' as well as 'Departure & Arrival' times are remembered until the Trip reset button is clicked.

The 'Total distance' is simply a counter of distance travelled and is not affected by tre reset button. Note that you can edit the 'Total distance' value in the OpenCPN configuration file e.g. if the GPS Odometer is replacing another Sumlog instrument. The format is '12345.6' (one decimal only) and remember to do that when OpenCPN is shut down or your change will be lost.

The Leg Trip functionality is a bit different as it has higher time and distance resolution, intended for e.g. tight navigation time and distance measurements. Like "How far is it between X and Y?" or "How long time does it take between Y and Z". It is always counting so just reset to begin a new count session nor does it use 'Minimum Route Speed'.

Several parameters can be adjusted in the 'Settings' menu, just right-click somewhere on the instrument and select to change the settings.

There is a strict requirement that NMEA 0183 sentences RMC and GGA are received, it is a GPS based Odometer. This is what happens if one or both of these sentences are missing:

There will be no speed or distance count if NMEA 0183 sentence RMC is missing. The GPS Odometer will not start displaying data until NMEA 0183 GGA is indicating a valid GPS signal. There is also a few seconds delay to allow for the position to be properly set. Many GPS units are somewhat inaccurate the first 10 seconds. The GPS Odometer will continue to register data even if the NMEA 0183 GGA is no longer flagging a correct GPS signal. This is due to the fact that OpenCPN 'm_NMEA0183.Gga.GPSQuality' does not detect this state change.

Bugs and inconveniences

Most of these bugs/inconveniences are inherited from the original dashboard. The instrument window downsizing when e.g. removing the speedometer does not downsize properly and I have no clue how to fix it. There are also other minor display size inconveniences inherited but these are corrected just grabbing the lower right corner and adjust the size. Worst case solution is to restart OpenCPN. Also, some of the parameters from the Settings menu does not update the instruments until OpenCPN is restarted, like the maximum speed setting in the speedometer.

Installing

The best and most convenient way to install is to use the package manager but if a suitable version is not availanble you may also build the application following the standard method compiling outside the OpenCPN source tree.

Building the application

This has only been tested on Linux and follows the standard procedure for build outside of the OpenCPN source tree. See the OpenCPN developer manual for details regarding other requirements such as git, cmake and wxWidgets as well as download procedures.

Once you have the application downloaded, extract and copy it to /usr/local/src/odometer, then use (with proper user rights):

cd /usr/local/src/odometer mkdir build cd build cmake .. cmake --build . --config release

To install as a user application directly usable by OpenCPN now use:

make install

If you prefer install packages, you may use:

cpack

The install packages will be generated in /usr/local/src/odometer/build/

A final comment

I did this plugin as I wanted a simple GPS based Odometer and was surprised not to find it in OpenCPN. The Logbook has the option but I did not need all the other stuff in there and wanted an on-screen solution. Being a former Linux system administrator, never having done anything in C, C++ nor wxWidgets it was quite a challenge. So I admit that this is probably the worst piece of code you have ever seen - but it appears to work. Have used the GPS Odometer on Ubuntu 18.04 and 20.04 with OpenCPN versions 5.0 and 5.2. I don't own an RPi, a Windows machine nor a MAC so never tested there.

Any programmer is encouraged to fork this and 'get it in order', fact is I want that to happen. Fork the code, fix the bugs and inconveniences - as long as the concept is kept I will not mind.

For 'dry-runs' I recommend either trips recorded using OpenCPN VDR plugin or gpsfeed+ in a square pattern (getting various speeds).

Contact: You can PM me through OpenCPN in Cruisers Forum, look for LennartG or use Search -> Advanced search -> Search by user name.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published