Skip to content

Kalibr Installation Guide (DEPRICATED)

Alexander Thoms edited this page Aug 2, 2021 · 1 revision

For some of our projects, we use Kalibr to get camera intrinsics, for example, the Double Sphere camera model using the F4 camera.

If you ever find yourself needing to install Kalibr on your machine, here's what I found worked for me (the installation instructions available on eth-azl/kalibr wiki don't fully work anymore).

This may not completely apply to you, as it depends on what your setup is: I have my computer dual-booting Windows and Linux (Ubuntu 18).

Use Ubuntu 14.04

I've heard that some people have managed to get Kalibr to work with Ubuntu 16/18, though with mixed success and a lot of time spent chasing down dependencies. For the "easiest" install, use 14.04. I set up a VM using KVM for this, but VirtualBox or anything else will work. Unless you can afford to spare about 6 GB of RAM for your VM, this may not be the best way to go (building Kalibr requires this much memory or you may encounter out-of-memory errors on compilation). Since Kalibr is only used for calibration, being a little bit slower inside a VM was something I could put up with.

Install ROS Indigo

The following instructions are modified versions based on the installation guide for Kalibr.

Install ROS Indigo with these commands:

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu trusty 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
sudo apt-get install ros-indigo-desktop python-rosinstall python-rosdep -y
rosdep init
rosdep update 

Install the build and run dependencies for Kalibr:

sudo apt-get install python-setuptools python-rosinstall ipython libeigen3-dev libboost-all-dev doxygen libopencv-dev ros-indigo-vision-opencv ros-indigo-image-transport-plugins ros-indigo-cmake-modules python-software-properties software-properties-common libpoco-dev python-matplotlib python-scipy python-git python-pip ipython libtbb-dev libblas-dev liblapack-dev python-catkin-tools libv4l-dev

# Using version 0.7 is intentional, 0.8 has some backwards compatibility issues with the rest of Kalibr.
sudo pip install python-igraph==0.7.1.post6

The rest is the same as the Kalibr installation instructions:

Create a catkin workspace

mkdir -p ~/kalibr_workspace/src
cd ~/kalibr_workspace
source /opt/ros/indigo/setup.bash
catkin init
catkin config --extend /opt/ros/indigo
catkin config --merge-devel # Necessary for catkin_tools >= 0.4. 
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release

Clone Kalibr and build

cd ~/kalibr_workspace/src
git clone https://github.com/ethz-asl/Kalibr.git

cd ~/kalibr_workspace
catkin build -DCMAKE_BUILD_TYPE=Release -j2

Note: if you don't have a lot of resources available to your VM, you may want to try -j1 instead.

On my VM, the build process took about 45 minutes, and at the end of the build you'll see that it completed, but with many packages completing with warnings - these can be disregarded.

Source the setup

Like with ROS, in order to use it, you need to source the setup.bash first. With Kalibr:

source ~/kalibr_workspace/devel/setup.bash

You'll have to do this every time you open up a new terminal, or you can add it to your ~/.bashrc instead.

Setting up Samba (smb) to share files with your VM

I happened to have to share a 35 GB bag file with my VM and I decided it'd be better if I could easily share folders between the VM and the host, so I set up Samba as well. However, if you're using something else (i.e. VirtualBox) you may have a better time setting up a passthrough filesystem (9p mounting didn't work properly for me).

Using KVM, the host machine is accessible at 192.168.122.1 from within the guest. Follow these instructions to get Samba working on Ubuntu: https://ubuntu.com/tutorials/install-and-configure-samba#1-overview.

Then, inside your VM, you'll need to install cifs-utils:

sudo apt-get install cifs-utils

After which, you'll be able to mount your shared folder with:

sudo mount -t cifs -o user=yourusername,iocharset=utf8,noperm //192.168.122.1/Your_Share /your_mount_point

If you don't want to have to manually mount the share every time you start the VM, you can look into using fstab (I only needed to run Kalibr every now and then, so it doesn't matter much to me).

Creating Calibration Targets with Kalibr

If you want to be able to create a calibration target using kalibr_create_target, you will also need to install PyX and Latex on your system:

sudo apt-get update
sudo apt-get install texlive-latex-base
sudo pip install pyx==0.12.1

This is only for making a PDF that you can print. For the .YAML files for calibration, create a YAML file as follows (these are values for the big Apriltag grid we have):

target_type: 'aprilgrid'
tagCols: 6
tagRows: 6
tagSize: 0.48355
tagSpacing: 0.300922

More info on this can be found here: https://github.com/ethz-asl/kalibr/wiki/calibration-targets

Clone this wiki locally