-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add NTRIP Client implementation (#1)
This PR introduces an NTRIP client implementation that manages connections between an NTRIP server and a Novatel GNSS receiver. Key features include: - **NTRIP Client**: Connects to an NTRIP server to request and transmit RTCMv3 corrections. - **GNSS Receiver Integration**: Handles communication with a Novatel GNSS receiver, including configuration and data parsing. - **Data Handling**: Supports parsing of RTCM and NMEA data, and sends valid NMEA sentences to the NTRIP server. - **Logging and Configuration**: Configurable logging levels and settings, with support for fixed GPS locations. - **Docker Suppor**t: Added `Dockerfile`, `dev.sh`, and `runtime.sh` scripts for containerised deployment.
- Loading branch information
Showing
12 changed files
with
1,108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Create and publish a Docker image | ||
|
||
on: | ||
push: | ||
tags: ["*"] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.MY_REPO_PAT }} | ||
submodules: recursive | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
file: Dockerfile | ||
target: runtime | ||
build-args: | ||
BUILDKIT_CONTEXT_KEEP_GIT_DIR=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Python cache | ||
*pycache* | ||
|
||
# Logs | ||
*logs* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "scripts/av_ntrip_credentials"] | ||
path = scripts/av_ntrip_credentials | ||
url = [email protected]:ipab-rad/av_ntrip_credentials.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
|
||
# To use: | ||
# | ||
# pre-commit run -a | ||
# | ||
# Or: | ||
# | ||
# pre-commit install # (runs every time you commit in git) | ||
# | ||
# To update this file: | ||
# | ||
# pre-commit autoupdate | ||
# | ||
# See https://github.com/pre-commit/pre-commit | ||
|
||
repos: | ||
# Standard hooks | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-ast | ||
- id: check-case-conflict | ||
- id: check-docstring-first | ||
- id: check-merge-conflict | ||
- id: check-symlinks | ||
- id: check-xml | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
exclude_types: [rst] | ||
- id: fix-byte-order-marker | ||
|
||
# Python hooks | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.17.0 | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py36-plus] | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 24.8.0 | ||
hooks: | ||
- id: black | ||
args: ["--line-length=79", -S] | ||
|
||
# CPP hooks | ||
- repo: https://github.com/pre-commit/mirrors-clang-format | ||
rev: v18.1.8 | ||
hooks: | ||
- id: clang-format | ||
args: ['-fallback-style=none', '-i'] | ||
|
||
- repo: local | ||
hooks: | ||
- id: ament_cppcheck | ||
name: ament_cppcheck | ||
description: Static code analysis of C/C++ files. | ||
entry: env AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS=1 ament_cppcheck | ||
language: system | ||
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$ | ||
|
||
- repo: local | ||
hooks: | ||
- id: ament_cpplint | ||
name: ament_cpplint | ||
description: Static code analysis of C/C++ files. | ||
entry: ament_cpplint | ||
language: system | ||
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$ | ||
args: ["--linelength=100", "--filter=-legal/copyright,-build/include_order"] | ||
|
||
# Cmake hooks | ||
- repo: local | ||
hooks: | ||
- id: ament_lint_cmake | ||
name: ament_lint_cmake | ||
description: Check format of CMakeLists.txt files. | ||
entry: ament_lint_cmake | ||
language: system | ||
files: CMakeLists\.txt$ | ||
|
||
- repo: https://github.com/cheshirekow/cmake-format-precommit | ||
rev: v0.6.13 | ||
hooks: | ||
- id: cmake-format | ||
|
||
# Docs - RestructuredText hooks | ||
- repo: https://github.com/PyCQA/doc8 | ||
rev: v1.1.1 | ||
hooks: | ||
- id: doc8 | ||
args: ['--max-line-length=100', '--ignore=D001'] | ||
exclude: CHANGELOG\.rst$ | ||
|
||
- repo: https://github.com/pre-commit/pygrep-hooks | ||
rev: v1.10.0 | ||
hooks: | ||
- id: rst-backticks | ||
exclude: CHANGELOG\.rst$ | ||
- id: rst-directive-colons | ||
- id: rst-inline-touching-normal | ||
|
||
# Spellcheck in comments and docs | ||
# skipping of *.svg files is not working... | ||
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.3.0 | ||
hooks: | ||
- id: codespell | ||
args: ['--write-changes', '--uri-ignore-words-list=ist', '-L manuel,ned'] | ||
exclude: CHANGELOG\.rst|\.(svg|pyc|drawio|dae)$ | ||
|
||
# Check Github files | ||
- repo: https://github.com/python-jsonschema/check-jsonschema | ||
rev: 0.29.1 | ||
hooks: | ||
- id: check-github-workflows | ||
args: ["--verbose"] | ||
- id: check-github-actions | ||
args: ["--verbose"] | ||
- id: check-dependabot | ||
args: ["--verbose"] | ||
|
||
# Bash prettify | ||
- repo: https://github.com/lovesegfault/beautysh | ||
rev: v6.2.1 | ||
hooks: | ||
- id: beautysh | ||
|
||
# ROS checks | ||
- repo: https://github.com/tier4/pre-commit-hooks-ros | ||
rev: v0.10.0 | ||
hooks: | ||
- id: flake8-ros | ||
- id: prettier-xacro | ||
- id: prettier-launch-xml | ||
- id: prettier-package-xml | ||
- id: ros-include-guard | ||
- id: sort-package-xml | ||
|
||
# Dockerfiles | ||
- repo: https://github.com/AleksaC/hadolint-py | ||
rev: v2.12.1b3 | ||
hooks: | ||
- id: hadolint | ||
args: ['--ignore=DL3008'] | ||
|
||
ci: | ||
autofix_commit_msg: | | ||
[pre-commit.ci] auto fixes from pre-commit.com hooks | ||
for more information, see https://pre-commit.ci | ||
autofix_prs: false | ||
autoupdate_branch: '' | ||
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' | ||
autoupdate_schedule: monthly | ||
skip: [ament_cppcheck, ament_cpplint, ament_lint_cmake] | ||
submodules: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Use the official Ubuntu 24.04 as a base image | ||
FROM ubuntu:24.04 AS base | ||
|
||
# Set environment variables to avoid interaction during package installation | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# Install Python3, venv and pip | ||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \ | ||
python3 \ | ||
python3-venv \ | ||
python3-pip \ | ||
&& rm -rf /var/lib/apt/lists/* "$HOME"/.cache | ||
|
||
# Install required Python packages using venv + pip | ||
RUN python3 -m venv /opt/ntrip_venv \ | ||
&& /opt/ntrip_venv/bin/pip install --no-cache-dir pyyaml colorlog pyrtcm | ||
|
||
# Set the environment variable so that the following commands use the venv | ||
ENV PATH="/opt/ntrip_venv/bin:$PATH" | ||
|
||
# Create a working directory | ||
WORKDIR /workspace/scripts | ||
|
||
FROM base AS dev | ||
|
||
# Install dev tools | ||
RUN apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \ | ||
net-tools \ | ||
nano \ | ||
python-is-python3 \ | ||
&& rm -rf /var/lib/apt/lists/* "$HOME"/.cache | ||
|
||
# Run bash terminal by default | ||
CMD ["bash"] | ||
|
||
FROM base AS runtime | ||
|
||
# Copy scripts dierectory | ||
COPY ./scripts /workspace/scripts | ||
|
||
# Make sure the script is executable | ||
RUN chmod +x /workspace/scripts/ntrip_client.py | ||
|
||
# Set the entrypoint to run the Python script and forward arguments | ||
ENTRYPOINT ["python3", "ntrip_client.py"] | ||
|
||
# No default arguments | ||
CMD [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,61 @@ | ||
# av_ntrip_client | ||
|
||
NTRIP client for RTK corrections in the AV's GNSS system. | ||
|
||
## Overview | ||
|
||
`av_ntrip_client` is a tool designed to connect the IPAB Autonomous Vehicle's Novatel PwrPak7d GNSS to the Smartnet NTRIP server, providing Real-Time Kinematic (RTK) corrections to enhance GNSS accuracy. The client is containerised using Docker for ease of deployment and use. | ||
|
||
## Features | ||
|
||
- Connects to the Smartnet NTRIP server for RTK corrections. | ||
- Supports live GNSS GPS reading or fixed location data. | ||
- Logs generated for troubleshooting and analysis. | ||
|
||
## Setup | ||
|
||
1. **Clone the Repository:** | ||
|
||
- **For General Public:** | ||
```bash | ||
git clone https://github.com/ipab-rad/av_ntrip_client.git | ||
``` | ||
|
||
- **For Authorised Users:** | ||
If you have authorised access to the `av_ntrip_client` repository, use: | ||
```bash | ||
git clone --recurse-submodules [email protected]:ipab-rad/av_ntrip_client.git | ||
``` | ||
|
||
2. **Build and Run the Docker Container:** | ||
|
||
- **Development Mode:** | ||
This mode mounts the current `scripts` directory into the container, allowing for live development. | ||
```bash | ||
./dev.sh | ||
``` | ||
|
||
- **Runtime Mode:** | ||
This mode builds the Docker container and runs it with the specified options. The script will automatically start `ntrip_client.py`. You can pass arguments such as `--use-fix-location` `--debug` or `--help`. | ||
```bash | ||
./runtime.sh [options] | ||
``` | ||
- Example: | ||
```bash | ||
./runtime.sh --use-fix-location --debug | ||
``` | ||
## Usage | ||
|
||
Once the container is running, `ntrip_client.py` will automatically connect to the Smartnet NTRIP server using the provided credentials. Logs will be saved in the `scripts/logs` directory. | ||
|
||
## NTRIP Server Credentials | ||
|
||
The `scripts/av_ntrip_credentials` directory is a protected submodule due to licensing requirements of the Smartnet service. Access is restricted to authorised personnel only. | ||
|
||
## License | ||
|
||
This project is licensed under the terms of the Apache-2.0 [LICENCE](./LICENSE) file. | ||
|
||
## Contact | ||
|
||
For any issues or questions, please contact [Alejandor Bordallo](https://github.com/GreatAlexander) or [Hector Cruz](https://github.com/hect95) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
# ---------------------------------------------------------------- | ||
# Build docker dev stage and add local code for live development | ||
# ---------------------------------------------------------------- | ||
|
||
BASH_CMD="" | ||
|
||
# Function to print usage | ||
usage() { | ||
echo " | ||
Usage: dev.sh [-b|bash] [-h|--help] | ||
Where: | ||
-b | bash Open bash in docker container | ||
-h | --help Show this help message | ||
" | ||
exit 1 | ||
} | ||
|
||
# Parse command-line options | ||
while [[ "$#" -gt 0 ]]; do | ||
case $1 in | ||
-b|bash) | ||
BASH_CMD=bash | ||
;; | ||
-h|--help) | ||
usage | ||
;; | ||
*) | ||
echo "Unknown option: $1" | ||
usage | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
# Create logs dir | ||
mkdir -p scripts/logs | ||
|
||
# Build the Docker image | ||
docker build \ | ||
-t av_ntrip_client:latest-dev \ | ||
-f Dockerfile --target dev . | ||
|
||
# Run the Docker container and pass any provided arguments | ||
docker run -it --rm --net host --privileged \ | ||
-v /etc/localtime:/etc/localtime:ro \ | ||
-v ./scripts:/workspace/scripts \ | ||
av_ntrip_client:latest-dev $BASH_CMD |
Oops, something went wrong.