Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor and simplify, replace argparse with click, add unit tests, change some topics & TFs #38

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a5b02a8
Add a compression type choice to the CLI
valgur Apr 30, 2019
a5584bc
Re-raise ImportError when importing pykitti
valgur Apr 30, 2019
c796788
Extensive refactoring, improve setup.py, rename some topics
valgur May 7, 2019
c2dcf71
Use imu_link frame_id instead of base_link for IMU TFs
valgur May 7, 2019
defb592
Use only K_camX P_rect_X0 pykitti to CameraInfo parameters
valgur May 9, 2019
8cb94a4
Add unit tests
valgur May 9, 2019
73c506e
Add support for running tests with 'setup.py test'
valgur May 9, 2019
3a8497f
Improve Dockerfile, fix some Python 2 incompatibilities
valgur May 9, 2019
dabe7e8
Fix a minor tqdm nuisance when running tests
valgur May 9, 2019
6d871e8
Handle opencv3 package being named differently on ROS distros
valgur May 9, 2019
afedade
Simplify .travis.yml by running tests inside Docker
valgur May 9, 2019
da7f2dc
Use more of pykitti's functionality
valgur May 10, 2019
700a212
Replace argparse with click
valgur May 10, 2019
4a05cda
Skip apt-get upgrade in Dockerfile to keep the image small
valgur May 10, 2019
fe0306f
.travis.yml: cache the test data
valgur May 10, 2019
2eec59d
Dockerfile: use 'perception' ROS base image, do not install matplotlib
valgur May 10, 2019
1b29c8c
Require click >= 7 for unit tests
valgur May 10, 2019
7d053bb
Dcokerfile" add --no-install-recommends to apt-get
valgur May 10, 2019
c316d8b
Reduce some code duplication in CLI arguments
valgur May 10, 2019
fb9a505
Follow the ROS conventions for camera info
valgur May 13, 2019
2d69962
Replace OrderedDict with simpler list
valgur May 14, 2019
281a1b8
Use the field names from pcl::PointXYZI
valgur May 14, 2019
77e96c3
Fix the order of base_link TF definition
valgur May 14, 2019
2338483
Merge branch 'master' into master
valgur May 14, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Created by .ignore support plugin (hsz.mobi)
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

Dockerfile
.travis.yml
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,5 @@ ENV/

# Temporary files from text editors
*~

tests/data
138 changes: 17 additions & 121 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,129 +1,25 @@
# Generic .travis.yml file for running continuous integration on Travis-CI for
# any ROS package.
#
# Available here:
# - http://felixduvallet.github.io/ros-travis-integration
# - https://github.com/felixduvallet/ros-travis-integration
#
# This installs ROS on a clean Travis-CI virtual machine, creates a ROS
# workspace, resolves all listed dependencies, and sets environment variables
# (setup.bash). Then, it compiles the entire ROS workspace (ensuring there are
# no compilation errors), and runs all the tests. If any of the compilation/test
# phases fail, the build is marked as a failure.
#
# We handle two types of package dependencies specified in the package manifest:
# - system dependencies that can be installed using `rosdep`, including other
# ROS packages and system libraries. These dependencies must be known to
# `rosdistro` and get installed using apt-get.
# - package dependencies that must be checked out from source. These are handled by
# `wstool`, and should be listed in a file named dependencies.rosinstall.
#
# There are two variables you may want to change:
# - ROS_DISTRO (default is indigo). Note that packages must be available for
# ubuntu 14.04 trusty.
# - ROSINSTALL_FILE (default is dependencies.rosinstall inside the repo
# root). This should list all necessary repositories in wstool format (see
# the ros wiki). If the file does not exists then nothing happens.
#
# See the README.md for more information.
#
# Author: Felix Duvallet <[email protected]>
language: generic

# NOTE: The build lifecycle on Travis.ci is something like this:
# before_install
# install
# before_script
# script
# after_success or after_failure
# after_script
# OPTIONAL before_deploy
# OPTIONAL deploy
# OPTIONAL after_deploy
services:
- docker

################################################################################
matrix:
include:
- env: ROS_DISTRO=kinetic
- env: ROS_DISTRO=lunar
- env: ROS_DISTRO=melodic

# Use ubuntu trusty (14.04) with sudo privileges.
dist:
- trusty
sudo: required
language:
- generic
cache:
- apt
directories:
# Avoid re-downloading the test data each time
- $TRAVIS_BUILD_DIR/testdata

# Configuration variables. All variables are global now, but this can be used to
# trigger a build matrix for different ROS distributions if desired.
env:
global:
- ROS_DISTRO=indigo
- ROS_CI_DESKTOP="`lsb_release -cs`" # e.g. [precise|trusty|...]
- CI_SOURCE_PATH=$(pwd)
- ROSINSTALL_FILE=$CI_SOURCE_PATH/dependencies.rosinstall
- CATKIN_OPTIONS=$CI_SOURCE_PATH/catkin.options
- ROS_PARALLEL_JOBS='-j8 -l6'

################################################################################

# Install system dependencies, namely a very barebones ROS setup.
before_install:
- sudo sh -c "echo \"deb http://packages.ros.org/ros/ubuntu $ROS_CI_DESKTOP main\" > /etc/apt/sources.list.d/ros-latest.list"
- wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
- sudo apt-get update -qq
- sudo apt-get install -y python-catkin-pkg python-rosdep python-wstool ros-$ROS_DISTRO-catkin
- source /opt/ros/$ROS_DISTRO/setup.bash
# Prepare rosdep to install dependencies.
- sudo rosdep init
- rosdep update

# Create a catkin workspace with the package under integration.
install:
- mkdir -p ~/catkin_ws/src
- cd ~/catkin_ws/src
- catkin_init_workspace
# Create the devel/setup.bash (run catkin_make with an empty workspace) and
# source it to set the path variables.
- cd ~/catkin_ws
- catkin_make
- source devel/setup.bash
# Add the package under integration to the workspace using a symlink.
- cd ~/catkin_ws/src
- ln -s $CI_SOURCE_PATH .
- sudo apt-get install -y python-dev python-numpy python-matplotlib ros-$ROS_DISTRO-tf ros-$ROS_DISTRO-opencv-candidate
- docker build . -t kitti2bag --build-arg ROS_DISTRO=${ROS_DISTRO}

# Install all dependencies, using wstool first and rosdep second.
# wstool looks for a ROSINSTALL_FILE defined in the environment variables.
before_script:
# source dependencies: install using wstool.
- cd ~/catkin_ws/src
- wstool init
- if [[ -f $ROSINSTALL_FILE ]] ; then wstool merge $ROSINSTALL_FILE ; fi
- wstool up
# package depdencies: install using rosdep.
- cd ~/catkin_ws
- rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO

# Compile and test (mark the build as failed if any step fails). If the
# CATKIN_OPTIONS file exists, use it as an argument to catkin_make, for example
# to blacklist certain packages.
#
# NOTE on testing: `catkin_make run_tests` will show the output of the tests
# (gtest, nosetest, etc..) but always returns 0 (success) even if a test
# fails. Running `catkin_test_results` aggregates all the results and returns
# non-zero when a test fails (which notifies Travis the build failed).
script:
- source /opt/ros/$ROS_DISTRO/setup.bash
- cd ~/catkin_ws
- catkin_make $( [ -f $CATKIN_OPTIONS ] && cat $CATKIN_OPTIONS )
# Run the tests, ensuring the path is set correctly.
- source devel/setup.bash
- catkin_make run_tests && catkin_test_results
- cd $CI_SOURCE_PATH
- sudo python setup.py install
- mkdir -p $HOME/kitti
- cd $HOME/kitti
- wget http://kitti.is.tue.mpg.de/kitti/raw_data/2011_09_26_drive_0048/2011_09_26_drive_0048_sync.zip
- unzip 2011_09_26_drive_0048_sync.zip
- wget http://kitti.is.tue.mpg.de/kitti/raw_data/2011_09_26_calib.zip
- unzip 2011_09_26_calib.zip
- kitti2bag -t 2011_09_26 -r 0048 raw_synced .

- docker run -v $TRAVIS_BUILD_DIR/testdata:/kitti2bag/tests/data --entrypoint '/bin/bash' kitti2bag -c '
source /opt/ros/$ROS_DISTRO/setup.bash &&
cd /kitti2bag &&
PYTHONIOENCODING=utf-8 python setup.py test --addopts=-svv
'
28 changes: 18 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
FROM ros:lunar-ros-base
ARG ROS_DISTRO=kinetic
FROM ros:${ROS_DISTRO}-perception

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get -y install \
ros-lunar-cv-bridge \
ros-lunar-opencv3 \
ros-lunar-tf \
python-pip python-matplotlib \
&& rm -rf /var/lib/apt/lists/*
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get -y update \
# && apt-get -y upgrade \
&& apt-get -y install --no-install-recommends \
ros-${ROS_DISTRO}-cv-bridge \
ros-${ROS_DISTRO}-tf \
python-pip \
&& apt-get -y autoremove && apt-get -y clean && rm -rf /var/lib/apt/lists/*
# setup.py will fail on older Ubuntu distros if pip and setuptools are not updated
RUN python -m pip install --upgrade pip setuptools \
&& pip install --upgrade \
# Upgrade numpy for pykitti's pandas requirement
numpy \
# Use the development version since a Python 2 incompatibility is not yet fixed in 0.3.1
git+https://github.com/utiasSTARS/pykitti.git
COPY . /kitti2bag
RUN pip install -e /kitti2bag
RUN pip install /kitti2bag

WORKDIR /data

ENTRYPOINT ["/kitti2bag/docker_entrypoint.sh"]

6 changes: 5 additions & 1 deletion docker_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/bash
set -e

# unset $@ since setup.bash catches some args like -h
args="$@"
set --

# setup ros environment
source "/opt/ros/$ROS_DISTRO/setup.bash"
exec kitti2bag "$@"
exec kitti2bag $args
Loading