Is there a way to manipulate an NMEA sentence in KPLEX?

316 views
Skip to first unread message

Gregory Vaughan

unread,
Oct 22, 2014, 11:52:07 AM10/22/14
to kp...@googlegroups.com

Is there an opportunity in KPLEX to modify an NMEA sentence before outputting?

My Garmin chartplotter can aggregate the NMEA 0183 data wind data I input into it with its own data in a single output. But it malforms the MWV sentence so none of my apps can display it, substituting an S for what should be a N for Knots (could possibly be converting to Statute mph, I need to go aloft and bring the instrument down soon for some work and can test then).

This would half the wiring and hardware complexity in my situation.


It might be useful in other circumstances, such as creating a sentence emulating a paddlewheel with a GPS speed, or translating a newer sentence to a deprecated older one or vice versa to get older and newer equipment to speak.

Keith Young

unread,
Oct 22, 2014, 1:07:18 PM10/22/14
to kp...@googlegroups.com



Is there an opportunity in KPLEX to modify an NMEA sentence before outputting?


Not directly yet in a way I would consider "clean" but it's certainly on the agenda.  It's do-able in some untidy ways though.  One way is to run two instances of kplex.  The first reads the serial input. It has two output interfaces, both of which write to a named pipe (FIFO).  One has an output filter which ensures it only writes MWV sentences.  The other writes everything *except* MWV.  You have a custom program/script which reads from the FIFO which the MWV sentences are being written to.  It modifies them and writes to a third FIFO.  Your second instance of kplex has two input interfaces, one of which reads the modified MWV sentences from the third FIFO, the other reads all the other sentences from the second FIFO which your first instances of kplex writes to.  You can then do as you wish with the combined result (tcp, broadcast, whatever).

Sounds worse than it is although you'd have to have separate config files for the two instances or specify everything for one as command line options, make judicious use of the "persist" flags and ensure your startup script starts everything nicely.

If you try it and get stuck do ask for more detail.  No timescale as yet on a kplex which can do that simply and neatly.

Tony Miller

unread,
Jun 7, 2015, 9:39:18 PM6/7/15
to kp...@googlegroups.com
You could do this with one instance of kplex with an extra output file and input file configured.

Then use a script to read from the output file, manipulate, and write back to the input file.

I used this approach for calculating true wind direction and speed here (https://github.com/drasgardian/truewind) but in your case if you just need to replace S with N in the string then you could probably use a simple shell script and some regular expressions.

Andy Barrow

unread,
Jan 27, 2017, 10:53:41 AM1/27/17
to kplex
I'm just learning about FIFOs, but wouldn't this be an opportunity for a named pipe? You could pipe to a script, output to another pipe and read the pipe with KPLEX? I'm wondering because I have a similar problem - my old ST-50 outputs depth, but only in feet, leaving the rest of the string blank (just commas). Couldn't I pipe to a script that creates a new string, adding depth in meters and fathoms, and adding a checksum?


Reply all
Reply to author
Forward
0 new messages