Porting GBX to other Applications
Learn the basics of parsing GBX output streams for use in other applications.
Overview
A common use case of PpRx output is to provide GNSS measurements and full PNT solutions to external applications. This is typically accomplished by streaming the GBX output to a parsing application through a POSIX pipe.
This tutorial provides a guide for running the example gbx_parser.py on a GBX stream
produced by PpRx in either the GUI or CLI. The gbx_parser.py example comes pre-packaged
within the locus-lock folder.
GUI Instructions
Set up PpRx to output a GBX stream to a named pipe:
- Configure PpRx
.optand.configfiles within the GUI. - Configure PpRx for
Post-Processingmode and enableSimulate Realtime. - Select a pre-recorded
.binfile as the data input. - Configure PpRx to output to a Named Pipe (for example
gbx_pipe) in the configured output folder. - In a terminal window, navigate to the output folder and create the named pipe with
mkfifo gbx_pipe.
Set up gbx_parser.py in a terminal window:
cd <locus-lock directory>/utilities/gbx-toolbox- Build the python virtual environment with
setup_venv.sh - Source the virtual environment with
source venv/bin/activate - Run the parser with
python3 gbx_parser.py --verbose --pipe_path '<output-folder-path>/gbx_pipe' --output_path '<output-folder-path>/parser_output.gbx'
The --output_path argument sets the file path to which parsed data is logged.
The parser will wait until data is published to the pipe.
To run PpRx and verify outputs:
- In the GUI, press the
Run PpRxbutton. - In the terminal window running
gbx_parser.py, observe the parsed message contents printed to the terminal.
CLI Instructions
Set up PpRx for CLI use:
- Create PpRx
.optand.configfiles (for exampleexample.optandexample.config) for post-processing a pre-recorded.bindataset. - Create a POSIX pipe with
mkfifo gbx_pipe. - Ensure PpRx is configured to write GBX data to the POSIX pipe with the
.optfile argument-o gbx_pipe.
Set up gbx_parser.py in a terminal window:
cd <locus-lock directory>/utilities/gbx-toolbox- Build the python virtual environment with
setup_venv.sh - Source the virtual environment with
source venv/bin/activate - Run the parser with
python3 gbx_parser.py --verbose --pipe_path '<path-to-gbx_pipe>' --output_path '<output-path-to-parser_output.gbx>'
To run PpRx from the CLI and verify outputs:
- In a terminal window, run PpRx with
pprx -f example.opt - In the terminal window running
gbx_parser.py, observe the parsed message contents printed to the terminal.
Streaming Over UDP
PpRx does not have a native UDP output option. To reach a parsing application over the network, keep PpRx writing to a local named pipe as above, then use netcat to forward that pipe's contents to a UDP port.
Create the named pipe and point PpRx at it as described in the CLI or GUI instructions above (for example -o gbx_pipe), then in a separate terminal window, forward the pipe to the destination host and port:
nc -u <hostname-or-ip> <port> < gbx_pipe
This works for keeping PpRx and the parsing application on the same host too: point netcat at 127.0.0.1 and a listening application bound to the same port.
On the receiving end, any application that can bind a UDP listener on the configured port can consume the stream. This includes gbx_parser.py, though it expects a file or named pipe path by default. Using gbx_parser.py with a UDP source as-is requires a small wrapper that binds a UDP socket and writes received data to a named pipe, or feeds it directly into a parser.
Expected Result
If run with gbx_parser.py --verbose, the parser will print parsed GBX message data while PpRx is running.
Additional Reading
gbx_parser.py is an example. For reduced overhead in high-performance applications, optimized
parsing applications are recommended. See GBX Protocol Description
for useful information when creating a GBX parsing application.