On this subsection will be shown all necessary steps to get Vision Module’s enviroment set in order to run/develop code.

Installing Ubuntu

First of all, we need to install Ubuntu [1]:
  1. Download Ubuntu from official website
  2. Burn the .iso image either in a CD-ROM, DVD-ROM or flash drive. If you decide to use the flash drive approach, take a look in this tutorial on how to create a bootable USB stick on Windows.
  3. Put the media in your computer and check whether the device comes first in the BIOS boot order. Take a look in this tutorial to learn how to change the boot order.
  4. The Ubuntu installation script must have initialized. Choose the preferred language, mark to download updates while installing and install third-party software and to erase the current disk. You may also manually create partitions and allocate space in disk according to your preferences.
  5. The installation will also require you geographic location and keyboard layout. The keyboard layout need not be the same as the selected language. For instance, if you bought your laptop in the United States, the preferred language may be Brazilian Portuguese and the keyboard layout English (US, alternative international) to allow typing accents.
  6. Afterwards, the installation will ask your name, the computer’s name (for network identification), an username and password. Do not forget this password, since it will also be the superuser password (unless changed).
  7. Finally, Ubuntu will be installed. This step requires to reboot the machine when finished.
  8. Update all packages to its last version. You can either use the Update Manager or the commands sudo apt-get update and sudo apt-get upgrade.

Installing ROS [2]

Add the ROS Debian packages source for Ubuntu 16.04.

sudo sh -c 'echo "deb $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

Setup keys

sudo apt-key adv --keyserver hkp:// --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

Update apt-get

sudo apt-get update

Install ROS Kinetic full

sudo apt-get install ros-kinetic-desktop-full

Initialize rosdep

sudo rosdep init
rosdep update

In order to setup environment variables, append the following to ~/.bashrc

# Sourcing ROS environment variables
source /opt/ros/kinetic/setup.bash
. ~/.bashrc

Configuring catkin workspace

ROS recommends the usage of catkin for building it’s packages. In order to achieve this, we’ll create a new directory catkin_ws, with an inner directory src and a CMakeLists.txt indicating it is a catkin workspace.

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
cd ..

Also, in order to setup environment variables, append the following to ~/.bashrc. Make sure to adapt to your usage if you don’t create the workspace in the ~/catkin_ws directory.

# Sourcing catkin environment variables
source ~/catkin_ws/devel/
. ~/.bashrc

Install OpenCV

On ROS Kinetic the OpenCV library its already installed, all you need to do is set PKG_CONFIG_PATH to point to ROS libs [3]:

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/ros/kinetic/lib/pkgconfig
sudo cp /opt/ros/kinetic/lib/pkgconfig/opencv-3.2.0-dev.pc /opt/ros/kinetic/lib/pkgconfig/opencv.pc

Install V4l Control Panel

Finally install V4lCP, which can be downloaded here, just click on available on the Software Center and follow system instructions to install from Ubuntu Store.

Now that enviroment is set, go ahead and Compile vision code, go to Compilation


[1]A VM can be used but depending on your machine, some algorithms may behave slower than in case that the system is really installed on HDD
[2]ROS installation guide
[3]ROS has keep opencv version sync with opencv repository, so the file opencv-3.2.0-dev.pc may be another opencv version, in case of error, just substitute opencv-3.2.0-dev.pc for existent opencv-version.pc in the folder.