Skip to content
Alessandro Fornasier edited this page Apr 25, 2023 · 2 revisions

Welcome to VINSEval Wiki.


Installation

Requirements

  • at least 10 GB of free storage workspace
  • active internet connection while docker build

General software dependencies

This repository and the subsequent estimators require several packages to be installed. Regardless, the framework needs the following general software packages to run correctly

  • ROS (kinetic or later) recommended melodic
  • Eigen (3.3.4 or later)
  • Boost (1.5 or later) recommended 1.71 or later
  • Python3 (3.4 or later) recommended 3.8

Install specific dependencies

# UPDATE
sudo apt update

# ROS PACKAGES
export ROS_DISTRO=$(rosversion -d)
sudo apt install ros-${ROS_DISTRO}-tf \
  ros-${ROS_DISTRO}-cv-bridge \
  ros-${ROS_DISTRO}-message-filters \
  ros-${ROS_DISTRO}-image-transport \
  ros-${ROS_DISTRO}-rosbaglive

# GRAPHIC DRIVERS
sudo apt install -y libzmqpp-dev libeigen3-dev
sudo apt install -y libvulkan1 vulkan-utils gdb
# NOTE: For AMD GPUs run also sudo apt install -y mesa-vulkan-drivers

Common estimator dependencies

Workspace Setup

The following describes how to setup the workspace from scratch and use the provided binary (download it). If you want to use a different simulation binary please refer to the subsection [Generic Binary](#Generic Binary). Further, ROS noetic has some Known ROS Issues with this setup.

This workspace setup describes the installation steps needed for development. If you would rather use a predefined setup for evaluation only instead, please consult the Docker Setup instead.

git clone URL vinseval_cws

# Init submodules
cd vinseval_cws
git submodule update --init --recursive --remote

# Init workspace
catkin init
echo 'source ~/vinseval_cws/devel/setup.bash' >> ~/.bashrc

# Build workspace
export ROS_DISTRO=$(rosversion -d)
rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y
catkin build

# NOTE: to avoid downloading the FlightGoggles renderer binary, use the following build command:
# catkin build --cmake-args -DFLIGHTGOGGLES_DOWNLOAD_BINARY=OFF

source ~/.bashrc

VINSEval Official Binary

  1. Download and unpack the new binary (eg. VINSEval_v1.0.0) from here

  2. Unzip and copy the binary into devel:

cd Downloads
unzip VINSEval_v1.0.0_amd_x86_64.zip
cd VINSEval_v1.0.0_amd_x86_64.zip
chmod +x VINSEval_v1.0.0_amd_x86_64.x86_64
rsync -avP VINSEval_v1.0.0_amd_x86_64.x86_64 VINSEval_v1.0.0_amd_x86_64_Data LinuxPlayer_s.debug UnityPlayer.so UnityPlayer_s.debug <$WS>/devel/lib/flightgoggles/*
  1. Config and build your catkin workspace:
catkin config --extend /opt/ros/${ROS_DISTRO}
catkin config -j 4 -l 4
catkin clean -b
catkin Build

That's it. If you experience any problems, please consult the Known ROS Issues section

  1. Change the binary name into the generate data scripts as described in Scene (pre-compiled binary)

Generic Binary

If the binary changes perform the following steps:

  1. Download and unpack the new binary (eg. FlightGoggles v2.0.4-b1):
cd ~/Downloads
wget https://github.com/mit-fast/FlightGoggles/releases/download/v2.0.4-b1/FlightGoggles_Linux64_v2.0.4-b1.zip
unzip FlightGoggles_Linux64_v2.0.4-b1.zip
  1. Copy all the data into devel:
cd v2.0.4-b1
chmod +x FlightGoggles.x86_64
rsync -avP FlightGoggles.x86_64 FlightGoggles_Data <$WS>/devel/lib/flightgoggles/*
  1. Edit the build configs and rebuild the workspace:
catkin config --extend /opt/ros/${ROS_DISTRO}
catkin config --camke-args -DFLIGHTGOGGLES_DOWNLOAD_BINARY=OFF
catkin config -j 4 -l 4
catkin clean -b
catkin build

Alternatively also the profile in the .catkin_config/no_binary.yaml can be used:

mkdir -p .catkin_tools/profiles/no_binary
cp .catkin_config/no_binary.yaml .catkin_tools/profiles/no_binary/config.yaml
  1. Change the binary name into the generate data scripts as described in Scene (pre-compiled binary)

Known ROS Issues

Submodule Update Error

There might be an issue with running git submodule update --init --recursive --remote:

fatal: Needed a single revision
Unable to find current origin/master revision in submodule path 'src/flightgoggles'

This is due to an issue with the .gitmodule file. If you get this error run it without the --remote flag, i.e., git submodule update --init --recursive.

Rosdep not found

If you are using ROS noetic or higher, you have to manually install the Python3 version of rosdep with

sudo apt install python3-rosdep

NVIDIA and Docker Software Setup

This section describes the installation and usage of VINSEval with a Docker environment using NVIDIA drivers. We currently have no support for AMD hardware.

Install nvidia cuda drivers

Follow the simple instructions at this web page.

Example for Ubuntu 18.04:

cd Downloads
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget http://developer.download.nvidia.com/compute/cuda/11.0.2/local_installers/cuda-repo-ubuntu1804-11-0-local_11.0.2-450.51.05-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804-11-0-local_11.0.2-450.51.05-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu1804-11-0-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
Example for Ubuntu 20.04:

cd Downloads
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.2.1/local_installers/cuda-repo-ubuntu2004-11-2-local_11.2.1-460.32.03-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2004-11-2-local_11.2.1-460.32.03-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu2004-11-2-local/7fa2af80.pub
sudo apt update
sudo apt install -y cuda

Install Docker

Install the docker environment as described also here.

cd Downloads
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh

Install Nvidia Docker Packages

This has been taken from here.

# Add the package repositories
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list

sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker

Restart your system for the driver changes to take effect.

Build the docker container for FlightGoogles

If you have not done so before, download VINSEval and update all submodules.

git clone URL vinseval_cws
# Init submodules
cd vinseval_cws
git submodule update --init --recursive --remote

Build the Docker container

cd vinseval_cws
docker build --network=host -t vinseval -f docker/Dockerfile .

Sit back and relax, or get a coffee, this will take a while (approx. 2 hours).


Usage

Run the Docker container

cd vinseval_cws
XSOCK=/tmp/.X11-unix
XAUTH=/tmp/.docker.xauth
touch $XAUTH
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
chmod 755 $XAUTH
docker run --net=host --volume=$PWD/docker/persist:/mnt/host:rw --volume=$XSOCK:$XSOCK:rw --volume=$XAUTH:$XAUTH:rw --env "DISPLAY" --env="XAUTHORITY=${XAUTH}" --gpus all -ti --rm vinseval

Generate Data

If you are running VinsEval without docker:

cd ~/vinseval_cws/scripts
./generate_data_docker.sh

This will generate the data save it to the bagfile folder.

Otherwise, inside the docker container:

cd /root/${CATKIN_WS}/scripts
./generate_data_docker.sh

This will generate the data save it to the docker/persist folder.

However, you might want to modify the way data is generated by changing any of the possible following parameters:

  1. Path where bagfiles are saved (only for non docker version)
  2. Scene (pre-compiled binary)
  3. Number of attributes and attributes to be excluded from data generation
  4. Number of levels per attribute
  5. Number of runs per attribute and level
  6. Camera rendering option
  7. Direction of changes in illumination
  8. IMU parameters

To do so, we are planning to open-source a GUI to easilly change all the parameters, however, until then, you would have to directly modify the data generation script, script/generate_data.sh or, if you are running VinsEval within the docker container, script/docker/generate_data_docker.sh.

Path where bagfiles are saved (only for non docker version)

# Absolute Path to cws and to bagfiles
PATH_TO_BAG=/custom_path

Scene (pre-compiled binary)

# Scene and binary name
SCENE_NAME=custom_scene_name
BINARY_NAME=custom_binary_name

Number of attributes and attributes to be excluded from data generation

# Number of attributes (see dictionary above)
ATTRIBUTES=5
EXLUDE_ATTRIBUTES=(1,4,8)

Number of levels per attribute

# Number of levels per attribute
LEVELS=7

Number of runs per attribute and level

# Number of runs for a single level
RUNS=12

Camera rendering option

# Option for synched rendering (CAM_RATE could be only IMU_RATE divided by a natural number)
SYNCH=true
CAM_RATE=40

# Image dimension
IMG_WIDTH=640
IMG_HEIGHT=480

# Camera FOV
FOV=70

# Image colormap (true, false)
GRAY=true

# Fisheye coefficient step and starting threshold
FISH_THRESH=0.6
FISH_STEP=0.08

Direction of changes in illumination

# Illumination changes direction (up, down, random)
ILL_DIR=down

IMU parameters

# IMU noise and delay multiplier
IMU_NOISE_MUL=$( echo "scale=7; l(200)/9" | bc -l )
DELAY_MUL=$( echo "scale=4; (5*0.001)/3" | bc -l )

# Imu rate
IMU_RATE=200

# Imu params (true, false)
IS_IMU_NOISY=false
IS_IMU_BODY_REF=false
IS_GRAVITY_ADDED_IMU=false

# Fixed optimal imu noise values
fix_acc_noise_density=$( echo "scale=7; 5.268e-3" | sed 's/\([+-]\{0,1\}[0-9]*\.\{0,1\}[0-9]\{1,\}\)[eE]+\{0,1\}\(-\{0,1\}\)\([0-9]\{1,\}\)/(\1*10^\2\3)/g' | bc -l )
fix_gyro_noise_density=$( echo "scale=8; 5.268e-4" | sed 's/\([+-]\{0,1\}[0-9]*\.\{0,1\}[0-9]\{1,\}\)[eE]+\{0,1\}\(-\{0,1\}\)\([0-9]\{1,\}\)/(\1*10^\2\3)/g' | bc -l )
fix_acc_random_walk=$( echo "scale=8; 5.268e-4" | sed 's/\([+-]\{0,1\}[0-9]*\.\{0,1\}[0-9]\{1,\}\)[eE]+\{0,1\}\(-\{0,1\}\)\([0-9]\{1,\}\)/(\1*10^\2\3)/g' | bc -l )
fix_gyro_random_walk=$( echo "scale=9; 5.268e-5" | sed 's/\([+-]\{0,1\}[0-9]*\.\{0,1\}[0-9]\{1,\}\)[eE]+\{0,1\}\(-\{0,1\}\)\([0-9]\{1,\}\)/(\1*10^\2\3)/g' | bc -l )

Evaluate Data

If you are running VinsEval without docker:

cd ~/vinseval_cws/scripts
./estimator_run.sh
Otherwise, inside the docker container:

cd /root/${CATKIN_WS}/scripts
./estimator_run_docker.sh

Before running the data evaluation scripts, however, you would modify them accordingly to your setup on data generation or in the case you either want to evaluate only a subset of generated data or only run a subset of estimators. To do so you would have to modify script/estimator_run.sh or, if you are running VinsEval within the docker container, script/docker/estimator_run_docker.sh.

# Bagfile play rate (>1 if you want to play the bag files faster, <1 if you want to play the bag files slower)
BAG_RATE=1

# Estimators 
OPENVINS=1
VINSMONO=2

# Absolute Path to cws and to bagfiles (mimic data generation script)
PATH_TO_CWS=path_to_cws
PATH_TO_BAG=path_to_bag

# Number of attributes (see dictionary above)
ATTRIBUTES=5
EXLUDE_ATTRIBUTES=(1,4,8)

# Number of levels per attribute
LEVELS=7

# Number of runs for a single level
RUNS=12

# IMU noise and delay multiplier
IMU_NOISE_MUL=$( echo "scale=7; l(200)/9" | bc -l )
DELAY_MUL=$( echo "scale=4; (5*0.001)/3" | bc -l )

# Fixed optimal imu noise values (2nd batch correspond to imu lvl=5)
fix_acc_noise_density=$( echo "scale=7; 5.268e-3" | sed 's/\([+-]\{0,1\}[0-9]*\.\{0,1\}[0-9]\{1,\}\)[eE]+\{0,1\}\(-\{0,1\}\)\([0-9]\{1,\}\)/(\1*10^\2\3)/g' | bc -l )
fix_gyro_noise_density=$( echo "scale=8; 5.268e-4" | sed 's/\([+-]\{0,1\}[0-9]*\.\{0,1\}[0-9]\{1,\}\)[eE]+\{0,1\}\(-\{0,1\}\)\([0-9]\{1,\}\)/(\1*10^\2\3)/g' | bc -l )
fix_acc_random_walk=$( echo "scale=8; 5.268e-4" | sed 's/\([+-]\{0,1\}[0-9]*\.\{0,1\}[0-9]\{1,\}\)[eE]+\{0,1\}\(-\{0,1\}\)\([0-9]\{1,\}\)/(\1*10^\2\3)/g' | bc -l )
fix_gyro_random_walk=$( echo "scale=9; 5.268e-5" | sed 's/\([+-]\{0,1\}[0-9]*\.\{0,1\}[0-9]\{1,\}\)[eE]+\{0,1\}\(-\{0,1\}\)\([0-9]\{1,\}\)/(\1*10^\2\3)/g' | bc -l )
fix_rovio_acc_noise_density=$( echo "scale=10; ${fix_acc_noise_density}*${fix_acc_noise_density}" | sed 's/\([+-]\{0,1\}[0-9]*\.\{0,1\}[0-9]\{1,\}\)[eE]+\{0,1\}\(-\{0,1\}\)\([0-9]\{1,\}\)/(\1*10^\2\3)/g' | bc -l )
fix_rovio_gyro_noise_density=$( echo "scale=12; ${fix_gyro_noise_density}*${fix_gyro_noise_density}" | sed 's/\([+-]\{0,1\}[0-9]*\.\{0,1\}[0-9]\{1,\}\)[eE]+\{0,1\}\(-\{0,1\}\)\([0-9]\{1,\}\)/(\1*10^\2\3)/g' | bc -l )
fix_rovio_acc_random_walk=$( echo "scale=12; ${fix_acc_random_walk}*${fix_acc_random_walk}" | sed 's/\([+-]\{0,1\}[0-9]*\.\{0,1\}[0-9]\{1,\}\)[eE]+\{0,1\}\(-\{0,1\}\)\([0-9]\{1,\}\)/(\1*10^\2\3)/g' | bc -l )
fix_rovio_gyro_random_walk=$( echo "scale=14; ${fix_gyro_random_walk}*${fix_gyro_random_walk}" | sed 's/\([+-]\{0,1\}[0-9]*\.\{0,1\}[0-9]\{1,\}\)[eE]+\{0,1\}\(-\{0,1\}\)\([0-9]\{1,\}\)/(\1*10^\2\3)/g' | bc -l )