Installing Carmen LCAD on Ubuntu 16.04 (English) - LCAD-UFES/carmen_lcad GitHub Wiki

Update apt:

sudo apt-get update

Install git:

sudo apt-get install git

Download Carmen and MAE through git (download while following the next steps):

git clone https://github.com/LCAD-UFES/carmen_lcad 
git clone https://github.com/LCAD-UFES/MAE.git

NOTE: If you obtained Carmen from a pendrive, perform “git pull” before starting the installations.

Install the libraries/packages below:

sudo apt-get install swig \
libgtk2.0-dev \
qt-sdk \
libimlib2 libimlib2-dev \
imagemagick libmagick++-dev \
libwrap0 libwrap0-dev tcpd \
libncurses5 libncurses5-dev \
libgsl2 \
libdc1394-22 libdc1394-22-dev libdc1394-utils \
cmake cmake-gui cmake-qt-gui \
libgtkglext1 libgtkglext1-dev \
libgtkglextmm-x11-1.2-0v5 \
libglade2-0 libglade2-dev \
freeglut3 freeglut3-dev \
libcurl3 libcurl3-nss libcurl4-nss-dev \
libglew1.5 libglew1.5-dev libglewmx1.5 libglewmx1.5-dev libglew-dev \
libkml-dev \
liburiparser1 liburiparser-dev \
libusb-1.0-0 libusb-1.0-0-dev libusb-dev \
libxi-dev libxi6 \
libxmu-dev libxmu6 \
build-essential libforms-dev \
byacc \
flex \
doxygen \
libgflags-dev \
libespeak-dev libfftw3-dev pkg-config \
libavcodec-dev libavformat-dev libswscale-dev libtbb2 libtbb-dev \
libjpeg-dev libpng-dev libpng++-dev libtiff-dev libjasper-dev \
libgstreamer-plugins-base1.0-dev gimp meld vim \
python-numpy python-dev python-pip python-wheel python3-numpy python3-dev \
python3-pip python3-wheel \
g++ mpi-default-dev openmpi-bin openmpi-common \
libqhull* libgtest-dev git-core \
libflann1.8 libboost1.58-all-dev libeigen3-dev \
libboost-all-dev libflann-dev libproj-dev libsuitesparse-dev libqt4-dev qt4-qmake \
make libtiff5-dev tcsh wget \
linux-headers-`uname -r` kmod libraw1394-11 libgtkmm-2.4-dev libglademm-2.4-dev \
libgtkglextmm-x11-1.2-dev libudev-dev libvtk5-dev qttools5-dev libasound2-dev \
mpg123 portaudio19-dev libjsoncpp-dev

If the computer has an NVIDIA GPU, follow the steps listed at github.com/LCAD-UFES/carmen_lcad/wiki/Installing-CUDA-%5BEnglish%5D.

For Eclipse installation, follow the steps listed at github.com/LCAD-UFES/carmen_lcad/wiki/Installing-Eclipse.

IMPORTANT: THE INSTALLATION OF THE PACKAGES BELOW CAN FOLLOW YOUR ORGANIZATION CRITERIA FOR DIRECTORIES IN YOUR LINUX! FOR EXAMPLE, THE MOST COMMON LOCATION IS /usr/local/ FOR LIBRARY PACKAGES. FOR PROGRAMS LIKE ECLIPSE, THE MOST COMMON DIRECTORY IS /opt/, SO THAT THESE PACKAGES WILL BE AVAILABLE TO ALL USERS OF THE MACHINE (TO ACCESS THE INSTALLATION FOLDERS, BECAUSE WHEN THE PACKAGE IS INSTALLED, MOST OF THEM ARE INSTALLED FOR ALL USERS)

IF YOU PREFER ANOTHER MODEL THAT WE SUGGEST, CREATE A FOLDER IN YOUR HOME DIRECTORY WITH THE NAME packages_carmen TO CENTRALIZE AND SEPARATE THESE PACKAGES.

BELOW EACH INSTALLATION STEP THERE WILL BE A BLOCK OF “Commands above in one line”. THIS OPTION JOINS ALL COMMANDS OF THE STEP INTO A SINGLE LINE OF CODE. IF YOU HAVEN’T INSTALLED CARMEN MORE THAN 5 TIMES YET, DO NOT USE THIS OPTION

THIS INSTALLATION WILL FOLLOW THE INSTALLATION MODEL IN ~/packages_carmen REMEMBER TO DELETE THE COMPRESSED FOLDERS (tar.gz etc) AFTER FINISHING THE INSTALLATIONS

Install OpenCV 3.1:

cd ~/packages_carmen
wget https://github.com/opencv/opencv/archive/3.1.0.tar.gz -O opencv_3.1.0.tar.gz
tar -zxvf opencv_3.1.0.tar.gz
cd opencv-3.1.0/
mkdir build
cd build/
cmake -D BUILD_TIFF=ON -D WITH_CUDA=OFF -D ENABLE_AVX=OFF -D WITH_OPENGL=OFF -D WITH_OPENCL=OFF -D WITH_IPP=OFF -D  WITH_TBB=ON -D WITH_EIGEN=OFF -D WITH_V4L=OFF -D WITH_VTK=OFF -D BUILD_TESTS=OFF -D  BUILD_PERF_TESTS=OFF -D CMAKE_BUILD_TYPE=RELEASE ..
make -j8
sudo make install
cd ../..

Commands above in one line:

wget https://github.com/opencv/opencv/archive/3.1.0.tar.gz -O opencv_3.1.0.tar.gz && tar -zxvf opencv_3.1.0.tar.gz && tar -zxvf opencv_3.1.0.tar.gz && cd opencv-3.1.0/ &&  mkdir build && cd build/ && cmake -D BUILD_TIFF=ON -D WITH_CUDA=OFF -D ENABLE_AVX=OFF -D WITH_OPENGL=OFF -D WITH_OPENCL=OFF -D WITH_IPP=OFF -D  WITH_TBB=ON -D WITH_EIGEN=OFF -D WITH_V4L=OFF -D WITH_VTK=OFF -D BUILD_TESTS=OFF -D  BUILD_PERF_TESTS=OFF -D CMAKE_BUILD_TYPE=RELEASE .. && make -j8 && sudo make install

During compilation, you may encounter the error “Hdf5 not found”. To resolve it, edit the file common.cmake (in the directory ../opencv/modules/python), and (just below the line set(PYTHON_SOURCE_DIR “${CMAKE_CURRENT_SOURCE_DIR}/../”)), insert the following lines:

find_package(HDF5)
include_directories(${HDF5_INCLUDE_DIRS})
recrie a pasta build e compile novamente

Install Bullet, FANN, and Kvaser SDK

wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/bullet/bullet-2.78-r2387.tgz
wget http://downloads.sourceforge.net/project/fann/fann/2.2.0/FANN-2.2.0-Source.tar.gz
wget "https://www.kvaser.com/downloads-kvaser/?utm_source=software&utm_ean=7330130980754&utm_status=V5.22.392" -O linuxcan.tar.gz

NOTE: THE PREVIOUS PROCEDURE TO DOWNLOAD THE LINUXCAN.TAR.GZ WAS TO GO TO THE WEBSITE “www.kvaser.com/downloads-kvaser/”, SELECT THE OPTION “Kvaser LINUX Driver and SDK”, CLICK ON “older versions”, AND FINALLY ON V5.22.392. THE DOWNLOAD USING WGET IS UNDER TESTING. PLEASE REPORT IF THE LINUXCAN INSTALLATION DOES NOT WORK ON YOUR MACHINE.

tar -xvf bullet-2.78-r2387.tgz
tar -xvf linuxcan.tar.gz
tar -xvf FANN-2.2.0-Source.tar.gz

Commands above in one line:

wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/bullet/bullet-2.78-r2387.tgz && wget http://downloads.sourceforge.net/project/fann/fann/2.2.0/FANN-2.2.0-Source.tar.gz && wget "https://www.kvaser.com/downloads-kvaser/?utm_source=software&utm_ean=7330130980754&utm_status=V5.22.392" -O linuxcan.tar.gz && tar -xvf bullet-2.78-r2387.tgz && tar -xvf linuxcan.tar.gz && tar -xvf FANN-2.2.0-Source.tar.gz

Continuing the installation:

cd bullet-2.78
./configure
make
sudo make install

cd ../linuxcan
make
sudo make install 

cd ../FANN-2.2.0-Source 
mkdir build && cd build
cmake ..
make
sudo make install
cd ../..

Commands above in one line:

cd bullet-2.78 && ./configure && make && sudo make install && cd ../linuxcan && make && sudo make install && cd ../FANN-2.2.0-Source && mkdir build && cd build && cmake .. && make && sudo make install && cd ../..

Install version 2.11 of FlyCapture

git clone https://github.com/RhobanDeps/flycapture.git
cd flycapture
sudo sh install_flycapture.sh
cd ..

Commands above in one line:

git clone https://github.com/RhobanDeps/flycapture.git && cd flycapture && sudo sh install_flycapture.sh && cd ..

After installing the dependencies, add the line below to the file /etc/modules (NEEDED?):

raw1394

Install PCL 1.8 (It takes a long time. USING ‘-j’ MAY FREEZE THE MACHINE!)

**Tip: start the installation at night and go to sleep.

wget https://github.com/PointCloudLibrary/pcl/archive/pcl-1.8.0.tar.gz
tar -xf pcl-1.8.0.tar.gz
cd pcl-pcl-1.8.0
mkdir build && cd build
cmake ..
make
sudo make install
cd ../..

Commands above in one line:

wget https://github.com/PointCloudLibrary/pcl/archive/pcl-1.8.0.tar.gz && tar -xf pcl-1.8.0.tar.gz && cd pcl-pcl-1.8.0 && mkdir build && cd build && cmake .. && make && sudo make install && cd ../..

Install libraries to use KINECT

wget http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.19/libusb-1.0.19.tar.bz2
tar -xvf libusb-1.0.19.tar.bz2
cd libusb-1.0.19
./configure
make
sudo make install
cd ..

wget https://github.com/OpenKinect/libfreenect/archive/v0.5.7.tar.gz
tar -xzvf v0.5.7.tar.gz
cd libfreenect-0.5.7
mkdir build && cd build
cmake ..
cp src/libfreenect.pc ../../
make
cp ../src/libfreenect.pc.in src/libfreenect.pc 
cp ../fakenect/fakenect.sh.in fakenect/fakenect.sh
sudo make install
sudo ldconfig /usr/local/lib64/
cd ../..

Commands above in one line:

wget http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.19/libusb-1.0.19.tar.bz2 && tar -xvf libusb-1.0.19.tar.bz2 && cd libusb-1.0.19 && ./configure && make && sudo make install && cd .. && wget https://github.com/OpenKinect/libfreenect/archive/v0.5.7.tar.gz && tar -xzvf v0.5.7.tar.gz && cd libfreenect-0.5.7 && mkdir build && cd build && cmake .. && cp src/libfreenect.pc ../../ &&  make && cp ../src/libfreenect.pc.in src/libfreenect.pc && cp ../fakenect/fakenect.sh.in fakenect/fakenect.sh && sudo make install && sudo ldconfig /usr/local/lib64/ && cd ../..

To test run:

freenect-glview

Install G2O library (READ CAREFULLY!):

Tip: Restart the machine beforehand, it’s a lengthy installation and may freeze the machine.

If you have the old g2o, remove it from where it was downloaded Ex:

/usr/local/g2o ou ~/packages_carmen/g2o

and the following folders if they exist:

/usr/local/include/g2o
/usr/local/lib/libg2o*
Você leu atentamente?!

If there’s a more efficient way, please contribute! =D

It’s up to your discretion whether to use /usr/local or ~/packages_carmen to install this library. If you use /usr/local, all commands must be preceded by sudo.

INSTALLATION MODEL FOR NEW VERSION of g2o

Be sure to have read the previous text carefully up to this point!

cd ~/packages_carmen
git clone https://github.com/RainerKuemmerle/g2o.git
cd g2o
mkdir build && cd build
cmake ../ -DG2O_BUILD_EXAMPLES=OFF
make -j 8
sudo make install
cd ../..

If in the future there is any compatibility issue with this LIB, a fork of the last working version is available on the LCAD git (here).

Make the symbolic link below from boost:

sudo ln -s /usr/lib/x86_64-linux-gnu/libboost_thread.so /usr/lib/x86_64-linux-gnu/libboost_thread-mt.so

Install dlib:

cd ~/packages_carmen
git clone https://github.com/davisking/dlib.git
cd dlib/
git checkout v19.17
git pull origin v19.17
mkdir build && cd build
cmake ..
make -j 8
sudo make install
cd ../..

Commands above in one line:

cd ~/packages_carmen && git clone https://github.com/davisking/dlib.git && cd dlib/ && git checkout v19.17 &&  git pull origin v19.17 && mkdir build && cd build && cmake .. && make -j 8 && sudo make install && cd ../..

Install libwnn:

git clone http://github.com/filipemtz/libwnn
cd libwnn
mkdir build && cd build
cmake ..
make -j 8
sudo make install
cd ../..

Commands above in one line:

git clone http://github.com/filipemtz/libwnn && cd libwnn && mkdir build && cd build && cmake .. && make -j 8 && sudo make install && cd ../..

Note: If the following error occurs:

CMake Warning at /home/mscdo/opencv-3.1.0/cmake/OpenCVConfig.cmake:166 (message):
  Found OpenCV Windows Pack but it has no binaries compatible with your
  configuration.

  You should manually point CMake variable OpenCV_DIR to your build of OpenCV
  library.
Call Stack (most recent call first):
  example/mnist/CMakeLists.txt:2 (find_package)

CMake Error at example/mnist/CMakeLists.txt:2 (find_package):
  Found package configuration file:

    /home/mscdo/opencv-3.1.0/cmake/OpenCVConfig.cmake

  but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
  NOT FOUND.

Delete the contents of the build folder to remove the configuration files, and redo the cmake command adding the path to the build folder of OpenCV:

rm -rf libwnn/build/*
cd libwnn/build
cmake -D OpenCV_DIR=~/packages_carmen/opencv-3.1.0/build/ ..
make -j 8
sudo make install
cd ../..

Install GSL

wget ftp://ftp.gnu.org/gnu/gsl/gsl-2.4.tar.gz
tar -zxvf gsl-*.*.tar.gz
cd gsl-2.4
./configure 
make
sudo make install
cd ..

Commands above in one line:

wget ftp://ftp.gnu.org/gnu/gsl/gsl-2.4.tar.gz && tar -zxvf gsl-*.*.tar.gz && cd gsl-2.4 && ./configure && make && sudo make install && cd ..

Instalar IMLIB

Go to the folder carmen_lcad/ubuntu_packages and run the commands below:

sudo dpkg -i imlib_1.9.15-20_amd64.deb 
sudo dpkg -i imlib-devel_1.9.15-20_amd64.deb

TO DO: Check if the steps below are really necessary (((Vinicius is testing)))

sudo ln -s /usr/lib64/libgdk_imlib.so.1.9.15 /usr/lib64/libgdk_imlib.a
sudo ln -s /usr/src/linux-headers-3.8.0-30/ /usr/src/linux

Install Porcupine -(skip)

This step is disabled. The Porcupine GitHub has been updated and no longer includes the installation method described.

 cd packages_carmen
 git clone https://github.com/Picovoice/Porcupine.git
 cd Porcupine
 tools/optimizer/linux/x86_64/pv_porcupine_optimizer -r resources/ -p linux -o . -w "ok e ara"
 export SYSTEM=linux
 export MACHINE=x86_64
 cd demo/alsa
 g++ -O3 -o alsademo -I../../include -L../../lib/${SYSTEM}/$MACHINE -Wl,-rpath ../../lib/${SYSTEM}/$MACHINE main.cpp -lpv_porcupine -lasound
 cp ../../ok\ e\ ara_linux.ppn ../../resources/keyword_files/pineapple_linux.ppn
 ./alsademo

Voice Interface

*If you wish to use the voice interface, follow the installation link at: github.com/LCAD-UFES/carmen_lcad/wiki/Installing-Voice-Interface-[English]

**A Google Cloud Console account with the credit option enabled will be required.

Preparation for MAE and CARMEN installation

Edit the .bashrc (gedit ~/.bashrc) and add at the end

#CARMEN
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export CARMEN_HOME=~/carmen_lcad
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/i386-linux-gnu/:/usr/lib/libkml:$CARMEN_HOME/lib
export PATH=$PATH:$CARMEN_HOME/bin

#OpenJaus
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CARMEN_HOME/sharedlib/OpenJAUS/libopenJaus/lib:$CARMEN_HOME/sharedlib/OpenJAUS/libjaus/lib:$CARMEN_HOME/sharedlib/OpenJAUS/ojTorc/lib:$CARMEN_HOME/sharedlib/OpenJAUS/ojIARASim/lib

#MAE
export MAEHOME=~/MAE
export PATH=$PATH:$MAEHOME/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MAEHOME/lib

#Darknet
export DARKNET_HOME=$CARMEN_HOME/sharedlib/darknet
export LD_LIBRARY_PATH=$DARKNET_HOME/lib:$LD_LIBRARY_PATH

#Darknet2
export DARKNET2_HOME=$CARMEN_HOME/sharedlib/darknet2
export LD_LIBRARY_PATH=$DARKNET2_HOME/lib:$LD_LIBRARY_PATH

#CUDA
export PATH=$PATH:/usr/local/cuda/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
export CUDA_LIBS=/usr/local/cuda/lib64

#Voice Interface
export GOOGLE_APPLICATION_CREDENTIALS=~/credentials/voice_interface_credentials.json
export PYTHONPATH=$PYTHONPATH:$CARMEN_HOME/src/voice_interface
export SYSTEM=linux
export MACHINE=x86_64
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CARMEN_HOME/packages_carmen/Porcupine/lib/linux/x86_64

#NOD_Tracker - always at the end
export PYTHONPATH=$CARMEN_HOME/src/neural_object_detector3/pedestrian_tracker:$PYTHONPATH

Update the environment variables in all terminals by running the command “bash”.

If you use Caffe, follow the installation steps listed at github.com/LCAD-UFES/carmen_lcad/wiki/Installing-Caffe-[English].

Install MAE

Make sure that bash has been updated so that the environment variables are loaded.

cd $MAEHOME
make

Check if the MAE library libnet_conn.a was generated in MAEHOME/lib and if the MAE compiler netcomp was generated in MAEHOME/bin.

Install CARMEN

IMPORTANT: (1) If your computer does not have an NVIDIA graphics card, Edit the Makefile with ‘gedit ../src/Makefile &’ and comment out the packages ‘tracker’, ‘neural_object_detector’, and ‘traffic_light’.

cd $CARMEN_HOME/src
./configure --nojava  --nozlib --nocuda
Should the C++ tools be installed for CARMEN: [Y/n] Y
Should Python Bindings be installed: [y/N] N
Searching for Python2.4... Should the old laser server be used instead of the new one: [y/N] N
enter nessa linha -> Install path [/usr/local/]: 
Robot numbers [*]: 1,2

To compile, use the make_all script. It cleans the files generated in the previous make (make clean) and executes the installation of all Carmen packages. *Congratulations to Rafael for writing this script! =D* Rafael’s script has two steps. In the first one, it may display some errors on the screen, but it’s okay. In the second step, the actual compilation occurs. In this phase, the script should proceed to the end without errors. Anyone who prefers can use the ‘make’ command in the carmen_lcad/src folder (see notes below).

cd ..
cd bin
./make_all        (veja abaixo antes de prosseguir)

IMPORTANT 1: If there’s a compilation error due to the lack of the lippicv library (modules Road_finding, moving_objects..), locate the libippicv library (find /usr/local/ -name “libippicv*” ) and add the folder where it’s located to the path, or simply copy it to the /usr/local/lib folder.

IMPORTANT 2: Due to the compilation order of Carmen, errors like “carmen/web_cam_interface.h: No such file or directory” may appear during the compilation of some modules. When this happens, enter the directory of the module (e.g., “web_cam”) that had the error, compile it, and try again. This can also happen with libraries during the linking phase. In this case, the error will be something like “cannot find -llane_detector_interface”. The solution is the same as in the previous case, enter the “lane_detector” directory, compile the module, and try again.

IMPORTANT 3: If you get the error “bash: ./configure: Permission denied”. Run the command chmod +x configure.

Download updated car maps (note: Help keep these links updated!)

map_ida_guarapari-20170403-3

map_voltadaufes-201903025-4

Unzip to the carmen_lcad/data folder

To store your git login and password:

git config credential.helper store

Git will store your credentials in clear text in a local file (.git-credentials) under your project directory (see below for the “home” directory)

Test the installation

To test if the installation was successful, run Carmen following the steps in the video. First execution of Carmen software.

Only for installation on IARA

If installing Carmen on the IARA computer, access Additional steps for installation on the IARA computer.

⚠️ **GitHub.com Fallback** ⚠️