Skip to content

Commit

Permalink
Add docker (#1)
Browse files Browse the repository at this point in the history
* add Dockerfile

* Update README.md

* fix rutx cred

* Update .github/workflows/build-docker-image.yaml

Co-authored-by: Dawid Kmak <[email protected]>

Co-authored-by: Dawid Kmak <[email protected]>
  • Loading branch information
pkowalsk1 and KmakD authored Dec 9, 2022
1 parent 4869d17 commit ba8169c
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/build-docker-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build/Publish Docker Image

on:
push:
branches:
- 'main'
workflow_dispatch:
inputs:
tag:
description: 'tag that the image will be built with'
required: true
default: 'noetic'
branch:
description: 'branch that will be used to build image'
required: true
default: 'main'

jobs:
build_nmea_gps_ros:
runs-on: ubuntu-20.04

steps:

- name: Checkout
uses: actions/checkout@v1
with:
ref: ${{ github.event.inputs.branch }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest

- name: Login to Docker Registry
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/arm64, linux/amd64
push: true
tags: husarion/nmea-gps:noetic
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM ros:noetic-ros-core

SHELL ["/bin/bash", "-c"]

WORKDIR /ros_ws

RUN apt-get update && \
apt-get install -y \
git \
python3-pip && \
pip3 install \
rosdep && \
git clone -b decode-udp-line https://github.com/ros-drivers/nmea_navsat_driver.git src/nmea_navsat_driver && \
rosdep init && \
rosdep update --rosdistro $ROS_DISTRO && \
rosdep install --from-paths src -y -i && \
source /opt/ros/$ROS_DISTRO/setup.bash && \
catkin_make -DCATKIN_ENABLE_TESTING=0 -DCMAKE_BUILD_TYPE=Release && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

COPY ./ros_entrypoint.sh /
ENTRYPOINT [ "/ros_entrypoint.sh" ]
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
# nmea-gps-docker
Building a Docker image for a GPS module

### GPS API

GPS data in [NMEA](https://en.wikipedia.org/wiki/NMEA_0183) format is forwarded to RPi IP address at port 5000, typically it is `10.15.20.2:5000`.
You can make sure the address is correct by typing [http://10.15.20.1](http://10.15.20.1) into your browser (Username: `admin`, Password: `Husarion1`). Navigate to `Services -> GPS -> NMEA -> NMEA forwarding -> Hostname and Port`. Remember that you must be connected to the robot's WIFi network. If changes were needed, finish the connfiguration by pressing `save & apply` at the bottom of the screen.

Data frequency is 1Hz and can be interacted ether with GPSD daemon (`gpsd -N udp://10.15.20.2:5000`) or directly with [ROS package](https://github.com/ros-drivers/nmea_navsat_driver/tree/decode-udp-line) redirecting signal to ROS topic.

It is recommended to use docker image. To start the container type:

```bash
git clone https://github.com/husarion/nmea-gps-docker.git
cd nmea-gps-docker

docker compose up
```

You should be able to see data on `/panther/fix` topic (`rostopic echo /panther/fix`).
13 changes: 13 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
services:

nmea-gps:
image: husarion/nmea-gps:noetic
container_name: nmea-gps
network_mode: host
environment:
- ROS_MASTER_URI=http://10.15.20.2:11311
command: >
rosrun nmea_navsat_driver nmea_socket_driver
__ns:=panther
_port:=5000
_local_ip:=10.15.20.2
7 changes: 7 additions & 0 deletions ros_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -e

source "/opt/ros/$ROS_DISTRO/setup.bash"
source "/ros_ws/devel/setup.bash"

exec "$@"

0 comments on commit ba8169c

Please sign in to comment.