From 83ade09b782b65563ca123b5681f3d7829164416 Mon Sep 17 00:00:00 2001 From: Dima Ponomarev <36133264+PonomarevDA@users.noreply.github.com> Date: Mon, 21 Mar 2022 20:03:30 +0300 Subject: [PATCH] add workflow, dockerfile, build and install scripts (#1) --- .github/workflows/catkin_build.yml | 28 ++++++++++++++++++++++++++++ Dockerfile | 28 ++++++++++++++++++++++++++++ README.md | 8 +++++++- scripts/docker/build_image.sh | 4 ++++ scripts/install.sh | 8 ++++++++ 5 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/catkin_build.yml create mode 100644 Dockerfile create mode 100755 scripts/docker/build_image.sh create mode 100755 scripts/install.sh diff --git a/.github/workflows/catkin_build.yml b/.github/workflows/catkin_build.yml new file mode 100644 index 0000000..3e309df --- /dev/null +++ b/.github/workflows/catkin_build.yml @@ -0,0 +1,28 @@ +name: catkin_build + +on: [push] + +defaults: + run: + shell: bash +jobs: + catkin_build: + runs-on: ubuntu-18.04 + container: + image: ros:melodic + steps: + - name: Install basic ROS requirements + run: | + apt-get update && \ + apt-get install -y python-catkin-tools python-pip python3-pip && \ + apt-get install -y python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential python-catkin-tools + + - uses: actions/checkout@v2 + with: + path: catkin_ws/src/geographiclib_conversions + + - name: Install geographiclib_conversions requirements + run: ./catkin_ws/src/geographiclib_conversions/scripts/install.sh + + - name: catkin build + run: source /opt/ros/melodic/setup.bash && cd catkin_ws && catkin build diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7a07ec7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +ARG ROS_DISTRO=melodic + +FROM ros:$ROS_DISTRO +LABEL description="geographiclib_conversions" +SHELL ["/bin/bash", "-c"] +WORKDIR /catkin_ws/src/geographiclib_conversions + + +# 1. Install basic requirements +RUN apt-get update && \ + apt-get install -y ros-$ROS_DISTRO-catkin \ + python3-pip \ + python3-catkin-tools +RUN if [[ "$ROS_DISTRO" = "melodic" ]] ; then apt-get install -y python-pip python-catkin-tools ; fi + +# 2. Copy repository +COPY ./ ./ + +# 3. Setup packages +RUN ./scripts/install.sh + +# 4. Build ROS +RUN source /opt/ros/$ROS_DISTRO/setup.bash && cd ../../ && catkin build + +CMD echo "main process has been started" && \ + source /opt/ros/$ROS_DISTRO/setup.bash && \ + source /catkin_ws/devel/setup.bash && \ + echo "container has been finished" diff --git a/README.md b/README.md index a0b7014..f8471a8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ # Wrapper library for Geographiclib -Download `wmm2020` from [here](https://geographiclib.sourceforge.io/html/magnetic.html) and put them into corresponding folder or use it from `wmm2020` folder inside repository. \ No newline at end of file +[Geographiclib](https://geographiclib.sourceforge.io/) is a small set of C++ classes for performing conversions between geographic, UTM, UPS, MGRS, geocentric, and local cartesian coordinates, for gravity (e.g., EGM2008), geoid height, and geomagnetic field (e.g., WMM2020) calculations, and for solving geodesic problems. + +This repository is a ROS wrapper under this library. + +# Installation + +See [Dockerfile](Dockerfile) or [.github/workflows/catkin_build.yml](.github/workflows/catkin_build.yml) as an example of installation. diff --git a/scripts/docker/build_image.sh b/scripts/docker/build_image.sh new file mode 100755 index 0000000..4d907e1 --- /dev/null +++ b/scripts/docker/build_image.sh @@ -0,0 +1,4 @@ +#!/bin/bash +cd "$(dirname "$0")" + +sudo docker build ../.. diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 0000000..e687c2f --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,8 @@ +#!/bin/bash +SCRIPT_FOLDER="$(dirname "$0")" +PACKAGE_FOLDER=$SCRIPT_FOLDER/.. +WMM_FOLDER=$PACKAGE_FOLDER/wmm2020/magnetic + +mkdir -p /usr/local/share/GeographicLib/magnetic && \ + cp $WMM_FOLDER/wmm2020.wmm /usr/local/share/GeographicLib/magnetic/wmm2020.wmm && \ + cp $WMM_FOLDER/wmm2020.wmm.cof /usr/local/share/GeographicLib/magnetic/wmm2020.wmm.cof \ No newline at end of file