Skip to content

Commit

Permalink
Add Docker usage example (#10)
Browse files Browse the repository at this point in the history
* add docker usage example
  • Loading branch information
ablakey authored Oct 19, 2018
1 parent 89944da commit 04f614f
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 23 deletions.
43 changes: 25 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,55 @@
# QGIS-ROS

A QGIS plugin for interacting with data from ROS topics and bags.

The ROSCon 2018 Presentation on QGIS-ROS can be found here: https://vimeo.com/293539252

## Requirements

- Ubuntu >= 16.04
- Python 3.5
- QGIS >= 3.1
- ROS 1

QGIS can be installed from: https://qgis.org/en/site/forusers/download.html You need to add a PPA if using Ubuntu 16.04.

## Installation
QGIS ROS is a valid Catkin package. Download and build:
QGIS can be installed from [the QGIS download page.][1] You need to add a PPA if using Ubuntu 16.04.

## Installation (source)
```bash
cd ~/my_ros_ws/src/
git clone git@github.com:locusrobotics/qgis_ros.git
git clone git@github.com/:learpathrobotics/wireless.git # Temporary
git clone git@github.com:locusrobotics/json_transport.git # Temporary
git clone git@github.com/clearpathrobotics/wireless.git
git clone git@github.com:locusrobotics/json_transport.git
catkin build

cd ~/my_ros_ws/src/qgis_ros
pip3.5 install -r requirements.txt # Temporary
pip3 install -r requirements.txt
```

Note that the temporary dependencies will be addressed by https://github.com/locusrobotics/qgis_ros/issues/9

## Use

Simple:
## Usage (source)
```bash
rosrun qgis_ros start_qgis_ros
```

Once QGIS is loaded, navigate to Plugins -> Installed -> and enable QGIS_ROS with the checkbox. You only need to do this once.

With custom ROS Message Translators:
```bash
export QGIS_ROS_EXTRA_TRANSLATORS='custompythonmodule.translators'
rosrun qgis_ros start_qgis_ros
```

QGIS ROS is a fully qualified QGIS plugin but is not yet uploaded to the Plugin Registry. Therefore, activating the plugin is done by setting `QGIS_PLUGINPATH` to where this plugin is found, and then runing `qgis`. Optionally, you can launch it in a terminal where the `ROS_MASTER_URI` is set to your desired ROS Master. Otherwise only bagfile access is available.
## Usage (docker)
It can often be very tricky to comfortably resolve all dependencies in your workspace because of the combination of ROS1, Python3, GDAL 2, and QGIS.

It uses a lazy/reckless way to expose X server to the container. For alternatives, check out the [ROS Docker GUI Tutorial][2].

The plugin *should* be available and loaded by default, but you may have to open the Plugin Manager from within QGIS and enable it once.
```
cd ~/my_catkin_ws/src/qgis_ros/docker
docker-compose build
xhost +local:root
docker-compose up
xhost -local:root # Remember to remove X server permissions after!
```

To use extra translators, you'll need to mount a volume with them and/or extend the image.

## ROS Message Translators
QGIS is able to read and write data from hundreds of formats and sources by translating these formats into a common in-memory format. In order to represent ROS messages in this format, we target common interchange formats (GeoJSON and GeoTIFF) to make it easy to extend. If you want to make use of a custom ROS message type, all you have to do is:
Expand All @@ -64,13 +69,15 @@ Only topics that have ROS Message Translators will appear. Not every message has


## Contributions

Contributions are appreciated. Please open a pull request.

Developers will notice that `camelCase` is being used in Python. This may seem unusual, but PyQT and QGIS both use `camelCase`.So we follow that standard in accordance with PEP8.

## Contact

Queries that don't fit well as GitHub issues can be directed to Andrew Blakey at ablakey@locusrobotics.com

Being a robogeographer is a lonely life. If there are any others out there, don't hesitate to say hi!


[1]: https://qgis.org/en/site/forusers/download.html
[2]: http://wiki.ros.org/docker/Tutorials/GUI
27 changes: 27 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM osrf/ros:lunar-desktop-full-xenial

### Installing system packages (system owner's responsibility)
RUN apt update && \
apt install -y wget software-properties-common python3-pip python-catkin-tools

### Installing QGIS (QGIS docs responsibility: https://qgis.org/en/site/forusers/alldownloads.html#debian-ubuntu)
RUN sh -c 'echo "deb http://qgis.org/ubuntugis xenial main" >> /etc/apt/sources.list'
RUN wget -O - http://qgis.org/downloads/qgis-2017.gpg.key | gpg --import; exit 0
RUN gpg --export --armor CAEB3DC3BDF7FB45 | apt-key add -
RUN add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable && \
apt update && \
apt install -y gdal-bin python-gdal python3-gdal qgis

RUN pip3 install rospkg

### Installing QGIS_ROS (QGIS_ROS docs responsibility: https://github.com/locusrobotics/qgis_ros)
RUN mkdir -p ~/catkin_ws/src
RUN /bin/bash -c " \
source /opt/ros/lunar/setup.bash && \
cd ~/catkin_ws/ && \
catkin init && \
git clone http://github.com/locusrobotics/qgis_ros.git src/qgis_ros && \
git clone http://github.com/clearpathrobotics/wireless.git src/wireless && \
rosdep install --from-paths src --ignore-src -yi && \
pip3 install msgpack && \
catkin build"
10 changes: 10 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3'
services:
qgis_ros_test:
build: .
environment:
- DISPLAY
- QT_X11_NO_MITSHM=1
volumes:
- "/tmp/.X11-unix:/tmp/.X11-unix:rw"
command: /bin/bash -c "source ~/catkin_ws/devel/setup.bash && rosrun qgis_ros start_qgis_ros"
6 changes: 4 additions & 2 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

<buildtool_depend>catkin</buildtool_depend>

<depend>nav_msgs</depend>
<depend>geometry_msgs</depend>
<exec_depend>geometry_msgs</exec_depend>
<exec_depend>json_transport</exec_depend>
<exec_depend>nav_msgs</exec_depend>
<exec_depend>rospack</exec_depend>

</package>
5 changes: 2 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
gnupg
msgpack
rospkg
msgpack
rospkg

0 comments on commit 04f614f

Please sign in to comment.