diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 98add506..00000000 --- a/Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -FROM ros:noetic-ros-base - -RUN apt-get update && apt-get install -y --no-install-recommends apt-utils -RUN apt-get install -y ros-noetic-image-geometry ros-noetic-pcl-ros \ - ros-noetic-cv-bridge git cmake build-essential unzip pkg-config autoconf \ - libboost-all-dev \ - libjpeg-dev libpng-dev libtiff-dev \ - # Use libvtk5-dev, libgtk2.0-dev in ubuntu 16.04 \ - libvtk7-dev libgtk-3-dev \ - libatlas-base-dev gfortran \ - libparmetis-dev \ - python3-wstool python3-catkin-tools \ - # libtbb recommended for speed: \ - libtbb-dev - -RUN mkdir -p /catkin_ws/src/ -RUN git clone https://github.com/MIT-SPARK/Kimera-VIO-ROS.git /catkin_ws/src/Kimera-VIO-ROS -RUN cd /catkin_ws/src/Kimera-VIO-ROS - # && git checkout ___ -RUN cd /catkin_ws/src/ && wstool init && \ - wstool merge Kimera-VIO-ROS/install/kimera_vio_ros_https.rosinstall && wstool update - -# Build catkin workspace -RUN apt-get install -y ros-noetic-image-pipeline ros-noetic-geometry ros-noetic-rviz - -RUN . /opt/ros/noetic/setup.sh && cd /catkin_ws && \ - catkin init && catkin config --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo && \ - catkin build diff --git a/README.md b/README.md index 2a0c81a3..863b2800 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ We kindly ask to cite our paper if you find this library useful: # 1. Installation +**If you use an Ubuntu version that is newer than 20.04, it is highly recommended that you use Docker due to avoid ROS imcompatibility issues. See `docker` directory for instructions.** + ## A. Prerequisities - Install ROS by following [our reference](./docs/ros_installation.md), or the official [ROS website](https://www.ros.org/install/). @@ -110,7 +112,7 @@ Download a [Euroc](https://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisuali 2. In another terminal, launch KimeraVIO ROS wrapper: ```bash - roslaunch kimera_vio_ros kimera_vio_ros_euroc.launch + roslaunch kimera_vio_ros kimera_vio_ros_euroc.launch online:=true ``` 3. In another terminal, launch rviz for visualization: diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..dcf99c40 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,45 @@ +FROM ros:noetic-ros-base + +# Some ROS dependencies require user input for keyboard version. +# This prevents those processes from stalling the install process. +ENV DEBIAN_FRONTEND=noninteractive + +ARG URL=https://github.com/MIT-SPARK/Kimera-VIO-ROS.git +ARG BRANCH=master +ARG THREADS=4 + +RUN apt-get update && apt-get install -y --no-install-recommends apt-utils +RUN apt-get install -y ros-noetic-image-geometry ros-noetic-pcl-ros \ + ros-noetic-cv-bridge git cmake build-essential unzip pkg-config autoconf \ + libboost-all-dev \ + libjpeg-dev libpng-dev libtiff-dev \ + # Use libvtk5-dev, libgtk2.0-dev in ubuntu 16.04 \ + libvtk7-dev libgtk-3-dev \ + libatlas-base-dev gfortran \ + libparmetis-dev \ + python3-wstool python3-catkin-tools \ + # libtbb recommended for speed: \ + libtbb-dev \ + # for use with rviz + xvfb + +RUN mkdir -p /catkin_ws/src/ +RUN git clone ${URL} /catkin_ws/src/Kimera-VIO-ROS +RUN cd /catkin_ws/src/Kimera-VIO-ROS && git checkout origin/${BRANCH} + +RUN cd /catkin_ws/src/ && wstool init && \ + wstool merge Kimera-VIO-ROS/install/kimera_vio_ros_https.rosinstall && wstool update + +# Build catkin workspace +RUN apt-get install -y ros-noetic-image-pipeline ros-noetic-geometry ros-noetic-rviz + +RUN . /opt/ros/noetic/setup.sh && cd /catkin_ws && \ + catkin init && catkin config --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo && \ + catkin build -j${THREADS} + +# Add to bashrc so user doesn't have to manually do this in every new ROS terminal. +RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc +RUN echo "source /catkin_ws/devel/setup.bash" >> ~/.bashrc + +# Resolves an issue where Rviz seg faults on older intel processors +RUN echo "export LIBGL_ALWAYS_SOFTWARE=1" >> ~/.bashrc \ No newline at end of file diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 00000000..fcda74ef --- /dev/null +++ b/docker/README.md @@ -0,0 +1,39 @@ +# Using the Kimera-VIO ROS wrapper with Docker + +## Building and running your container +To build the container, in this directory, run the following: +``` +docker build -t kimera_vio_ros:latest . +``` +The Dockerfile also provide build arguments which allow the user to specify: +1. URL (default: https://github.com/MIT-SPARK/Kimera-VIO-ROS.git)- The URL for the repository that you want to clone. This is useful when developing using a fork. +2. BRANCH (default: master) - The branch on the _remote_ repository that should be checked out to. Also useful when doing development. +3. THREADS (default: 4)- The number of threads to use when building with catkin. + +Example use with these flags: +``` +docker build -t kimera_vio_ros:latest \ + --build-arg URL=https://github.com/MIT-SPARK/Kimera-VIO-ROS.git \ + --build-arg BRANCH=master \ + --build-arg THREADS=8 . +``` + +To run the container, run the following command. This script allows X11 forwarding, which allows Rviz to be used with the container. +``` +./docker_test.bash [optional image name; default is kimera_vio_ros] +``` + +## Running the EuRoC demonstration with Rviz +For running the EuRoC demonstration with Rviz, follow the instructions [here](https://github.com/MIT-SPARK/Kimera-VIO-ROS?tab=readme-ov-file#2-usage). + +These instructions mention running various commands in multiple terminals. This can be done with Docker in the following ways: + +1. Using `docker exec` [commands](https://docs.docker.com/reference/cli/docker/container/exec/). +2. If you are using VS Code, you can use the Dev Containers [plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) to connect to your container and use terminals from within VS Code. +3. Using [tmux](https://www.redhat.com/en/blog/introduction-tmux-linux) for terminal multiplexing. + +## Possible errors: +* If your trajectory tracking looks incorrect immediately on running, update the `autoInitialize` field from 0 to 1 in `/catkin_ws/src/Kimera-VIO/params/Euroc/BackendParams.yaml`. + * In some configurations rviz seg faults if this value is 0. The exact cause is unknown, but will be investigated and fixed if possible. +* An X server should be installed on your local machine to allow Rviz to be used with the container. +* Currently, the default number of jobs for building is set to 4. With a 13th Gen Intel i7-1360P Processor, this takes up to ~8GB of RAM with no other applications running. You may want to reduce the number of jobs if your machine does not have enough memory. diff --git a/docker/docker_test.bash b/docker/docker_test.bash new file mode 100755 index 00000000..0aa75036 --- /dev/null +++ b/docker/docker_test.bash @@ -0,0 +1,19 @@ +#!/bin/bash + +# Base script taken from https://github.com/MIT-SPARK/Kimera-VIO/blob/master/scripts/docker/kimera_vio_docker.bash +DOCKER_CONTAINER="kimera_vio_ros" + +if [ "$#" -eq 1 ]; then + DOCKER_CONTAINER=$1 + echo "container name: $DOCKER_CONTAINER" +fi + +# Allow X server connection +xhost +local:root +docker run -it --rm \ + --env="DISPLAY" \ + --env="QT_X11_NO_MITSHM=1" \ + --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ + $DOCKER_CONTAINER +# Disallow X server connection +xhost -local:root diff --git a/install/kimera_vio_ros_https.rosinstall b/install/kimera_vio_ros_https.rosinstall index 940a08d6..d33d218b 100644 --- a/install/kimera_vio_ros_https.rosinstall +++ b/install/kimera_vio_ros_https.rosinstall @@ -13,7 +13,7 @@ - git: local-name: gtsam uri: https://github.com/borglab/gtsam.git - version: develop + version: 4.2 - git: local-name: opengv_catkin uri: https://github.com/MIT-SPARK/opengv_catkin.git @@ -38,10 +38,6 @@ local-name: Kimera-VIO uri: https://github.com/MIT-SPARK/Kimera-VIO.git version: master -- git: - local-name: Kimera-VIO-ROS - uri: https://github.com/MIT-SPARK/Kimera-VIO-ROS.git - version: master - git: local-name: glog_catkin uri: https://github.com/ethz-asl/glog_catkin.git diff --git a/install/kimera_vio_ros_ssh.rosinstall b/install/kimera_vio_ros_ssh.rosinstall index 093a5ee7..2a3ff2e2 100644 --- a/install/kimera_vio_ros_ssh.rosinstall +++ b/install/kimera_vio_ros_ssh.rosinstall @@ -13,7 +13,7 @@ - git: local-name: gtsam uri: git@github.com:borglab/gtsam.git - version: develop + version: 4.2 - git: local-name: opengv_catkin uri: git@github.com:MIT-SPARK/opengv_catkin.git @@ -38,10 +38,6 @@ local-name: Kimera-VIO uri: git@github.com:MIT-SPARK/Kimera-VIO.git version: master -- git: - local-name: Kimera-VIO-ROS - uri: git@github.com:MIT-SPARK/Kimera-VIO-ROS.git - version: master - git: local-name: glog_catkin uri: git@github.com:ethz-asl/glog_catkin.git diff --git a/rviz/kimera_vio_euroc.rviz b/rviz/kimera_vio_euroc.rviz index 354a2314..7417cc6f 100644 --- a/rviz/kimera_vio_euroc.rviz +++ b/rviz/kimera_vio_euroc.rviz @@ -6,7 +6,7 @@ Panels: Expanded: - /Global Options1 Splitter Ratio: 0.5 - Tree Height: 493 + Tree Height: 293 - Class: rviz/Selection Name: Selection - Class: rviz/Tool Properties @@ -22,10 +22,11 @@ Panels: Name: Views Splitter Ratio: 0.75836432 - Class: rviz/Time - Experimental: false Name: Time SyncMode: 0 SyncSource: PointCloud Time Horizon +Preferences: + PromptSaveOnExit: true Toolbars: toolButtonStyle: 2 Visualization Manager: @@ -33,6 +34,8 @@ Visualization Manager: Displays: - Class: rviz/TF Enabled: true + Filter (blacklist): "" + Filter (whitelist): "" Frame Timeout: 15 Frames: All Enabled: false @@ -42,7 +45,7 @@ Visualization Manager: Value: true cam1: Value: true - world: + odom: Value: true Marker Alpha: 1 Marker Scale: 1 @@ -51,7 +54,7 @@ Visualization Manager: Show Axes: true Show Names: true Tree: - world: + odom: base_link: cam0: {} @@ -74,9 +77,7 @@ Visualization Manager: Enabled: true Invert Rainbow: false Max Color: 255; 255; 255 - Max Intensity: 4096 Min Color: 0; 0; 0 - Min Intensity: 0 Name: PointCloud Time Horizon Position Transformer: XYZ Queue Size: 10 @@ -149,6 +150,7 @@ Visualization Manager: Keep: 1 Name: Odometry Position Tolerance: 0.100000001 + Queue Size: 10 Shape: Alpha: 1 Axes Length: 0.300000012 @@ -213,6 +215,7 @@ Visualization Manager: Z: 0 Pose Color: 255; 85; 255 Pose Style: None + Queue Size: 10 Radius: 0.0299999993 Shaft Diameter: 0.100000001 Shaft Length: 0.100000001 @@ -223,9 +226,9 @@ Visualization Manager: Name: PoseGraph Enabled: true Global Options: - Background Color: 255; 255; 255 + Background Color: 0; 0; 0 Default Light: true - Fixed Frame: world + Fixed Frame: odom Frame Rate: 30 Name: root Tools: @@ -236,7 +239,10 @@ Visualization Manager: - Class: rviz/FocusCamera - Class: rviz/Measure - Class: rviz/SetInitialPose + Theta std deviation: 0.2617993950843811 Topic: /initialpose + X std deviation: 0.5 + Y std deviation: 0.5 - Class: rviz/SetGoal Topic: /move_base_simple/goal - Class: rviz/PublishPoint @@ -264,8 +270,7 @@ Visualization Manager: Near Clip Distance: 0.00999999978 Pitch: 0.52479744 Target Frame: base_link - Value: ThirdPersonFollower (rviz) - Yaw: 2.69867611 + Yaw: 2.698676109313965 Saved: - Class: rviz/ThirdPersonFollower Distance: 6.81472015 @@ -286,8 +291,7 @@ Visualization Manager: Near Clip Distance: 0.00999999978 Pitch: 0.495398402 Target Frame: base_link - Value: ThirdPersonFollower (rviz) - Yaw: 3.04540014 + Yaw: 3.0454001426696777 Window Geometry: Debug Img: collapsed: false