Skip to content

Installing Carmen LCAD on Ubuntu 18.04 (English)

Lewis edited this page Jun 13, 2024 · 4 revisions

If the computer has an NVIDIA graphics card

Examine the steps listed at github.com/LCAD-UFES/carmen_lcad/wiki/Installing-CUDA-10-[English] before proceeding.

Update apt:

sudo apt-get update

Install git:

sudo apt-get install git

Download Carmen and MAE via git (download while following the next steps) (To avoid conflicts with the system, execute cd ~ before git clone, DO NOT modify the folder locations):

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

Alternatively, you can use gh:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
sudo apt-add-repository https://cli.github.com/packages
sudo apt update
sudo apt install gh
gh repo clone LCAD-UFES/carmen_lcad
gh repo clone LCAD-UFES/MAE

NOTE: If you’re getting Carmen from a USB drive, run “git pull” before starting the installations.

Install the following libraries/packages:

sudo apt-get install swig \
libgtk2.0-dev \
libimlib2 libimlib2-dev \
imagemagick libmagick++-dev \
libwrap0 libwrap0-dev tcpd \
libncurses5 libncurses5-dev libgsl23 \
libdc1394-22 libdc1394-22-dev libdc1394-utils \
libgtkglext1 libgtkglext1-dev \
libgtkglextmm-x11-1.2-0v5 \
libglade2-0 libglade2-dev \
freeglut3 freeglut3-dev \
libcurl4 libcurl4-nss-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

sudo apt-get install libgflags-dev 

sudo apt-get install libespeak-dev libfftw3-dev pkg-config \
libavcodec-dev libavformat-dev libswscale-dev libtbb2 libtbb-dev \
libjpeg-dev libpng-dev libpng++-dev libtiff-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.9 libboost1.65-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 \
libvtk6* \
qttools5-dev libasound2-dev \
mpg123 portaudio19-dev libjsoncpp-dev \
libglew2.0 libglew-dev \
libgtk-3-dev \
cmake cmake-curses-gui cmake-qt-gui gnuplot-qt inkscape

Note: libglewmx-dev was removed from the list because it was causing conflicts on Ubuntu 18.04. If someone verifies that it’s necessary, please check the correct version that doesn’t cause conflicts.

Next:

sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt update
sudo apt install libjasper1 libjasper-dev
sudo updatedb

If your computer has an NVIDIA card, follow the steps listed at github.com/LCAD-UFES/carmen_lcad/wiki/Installing-CUDA-10-[English] .

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 DIRECTORY ORGANIZATION CRITERIA ON YOUR LINUX SYSTEM! FOR EXAMPLE, THE MOST COMMON LOCATION IS /usr/local/ FOR LIBRARY PACKAGES. HOWEVER, FOR PROGRAMS LIKE ECLIPSE, THE MOST COMMON DIRECTORY IS /opt/, SO THAT THESE PACKAGES WILL BE AVAILABLE FOR ALL MACHINE USERS (TO ACCESS INSTALLATION FOLDERS, AS WHEN THE PACKAGE IS INSTALLED, MOST OF THEM ARE INSTALLED FOR ALL USERS)

IF YOU PREFER, ANOTHER MODEL WE SUGGEST IS TO CREATE A FOLDER IN YOUR HOME DIRECTORY NAMED 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 THE STEP COMMANDS 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.2.0:

cd $HOME
mkdir packages_carmen 
cd packages_carmen
wget https://github.com/opencv/opencv/archive/3.2.0.tar.gz -O opencv_3.2.0.tar.gz
wget https://github.com/opencv/opencv_contrib/archive/3.2.0.tar.gz -O opencv_contrib-3.2.0_.tar.gz
tar xvzf opencv_3.2.0.tar.gz
tar xzvf opencv_contrib-3.2.0_.tar.gz
cd opencv-3.2.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 INSTALL_C_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.2.0/modules -D CMAKE_BUILD_TYPE=RELEASE ..
make -j12
sudo make install
sudo ldconfig
sudo updatedb
cd ../..

Commands above in one line:

wget https://github.com/opencv/opencv/archive/3.2.0.tar.gz -O opencv_3.2.0.tar.gz && wget https://github.com/opencv/opencv_contrib/archive/3.2.0.tar.gz -O opencv_contrib-3.2.0_.tar.gz && tar xvzf opencv_3.2.0.tar.gz && tar xzvf opencv_contrib-3.2.0_.tar.gz && cd opencv-3.2.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 INSTALL_C_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.2.0/modules -D CMAKE_BUILD_TYPE=RELEASE .. && make -j12 && sudo make install && sudo ldconfig && sudo updatedb

During compilation, you may encounter the “Hdf5 not found” error. To resolve this, edit the common.cmake file (in the directory ../opencv/modules/python), and (right 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

OpenCV 3 and OpenCV 4 can coexist. If you need to install OpenCV 4, you can follow the instructions here: linuxize.com/post/how-to-install-opencv-on-ubuntu-18-04/

Install bullet, FANN and Kvaser SDK

sudo apt-get update 
sudo apt-get install libbullet-dev

wget http://downloads.sourceforge.net/project/fann/fann/2.2.0/FANN-2.2.0-Source.tar.gz
wget "https://www.kvaser.com/download/?utm_source=software&utm_ean=7330130980754&utm_status=latest" -O linuxcan.tar.gz

Note: The previous procedure to download the LINUXCAN.TAR.GZ file was to go to the website “www.kvaser.com/downloads-kvaser/”, then select the option “Kvaser LINUX Driver and SDK”.

tar -xvf linuxcan.tar.gz
tar -xvf FANN-2.2.0-Source.tar.gz

Commands above in one line:

cd ~/packages_carmen && sudo apt-get update && sudo apt-get install libbullet-dev && wget http://downloads.sourceforge.net/project/fann/fann/2.2.0/FANN-2.2.0-Source.tar.gz && wget "https://www.kvaser.com/download/?utm_source=software&utm_ean=7330130980754&utm_status=latest" -O linuxcan.tar.gz && tar -xvf linuxcan.tar.gz && tar -xvf FANN-2.2.0-Source.tar.gz

Continuing with the installation:

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 linuxcan && make && sudo make install && cd ../FANN-2.2.0-Source && mkdir build && cd build && cmake .. && make && sudo make install && cd ~/packages_carmen

Install flycapture 2.11 version

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 ..

If you encounter any dpkg-related errors with the description “dependency problems - leaving unconfigured”, please refer to the FAQ for the solution (here [github.com/LCAD-UFES/carmen_lcad/wiki/FAQ-Installing-carmen_lcad-[English]).

After installing the dependencies, add the following line to the /etc/modules file (IS THIS NECESSARY?):

raw1394

Install PCL 1.8 (It takes quite a while. 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

sudo apt install libusb-1.0-0
sudo apt-get install -y libfreenect-dev 
sudo apt install libfreenect-bin

If it doesn’t work..

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 time-consuming installation and may freeze the machine.

If you have an old version of 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 feel free to contribute! =D

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

INSTALLATION MODEL FOR NEW VERSION of g2o:

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

cd ~/packages_carmen
git clone https://github.com/LCAD-UFES/g2o-1.git
mv g2o-1 g2o
cd g2o
mkdir build && cd build
cmake ..
make -j 12
sudo make install
cd ../..

In case there’s any compatibility issue with this library in the future, a fork of the latest working version is available on the LCAD git (here [github.com/LCAD-UFES/g2o-1.git]).

((NOTE!)) The OFFICIAL g2o repository HAS BEEN UPDATED TO g++14, and currently, we are using g++11. If it’s necessary to use the official version, clone the version from: [github.com/RainerKuemmerle/g2o.git] instead of the LCAD version (Install only ONE of the versions).

Symbolic link below for 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 -b v19.17
git pull origin v19.17
mkdir build && cd build
cmake ..
make -j 12
sudo make install
cd ../..

Commands above in one line:

cd ~/packages_carmen && git clone https://github.com/davisking/dlib.git && cd dlib/ && git checkout -b 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 12
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 ../..

Observation: 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 rerun the cmake command adding the path to the OpenCV build folder:

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

sudo apt-get install libgsl0-dev

If it doesn’t work…

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 ..

Install IMLIB

sudo apt-get install libimlib2-dev

If it doesn’t work… Go to the carmen_lcad/ubuntu_packages folder and run the following commands:

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 ouster sdk

Download SDK 0.4.1:

 https://drive.google.com/file/d/1L5wQ-yqk9REpW62EWWOS1pmnvYHFsHPE/view?usp=sharing

Install the dependencies:

sudo apt install build-essential cmake libjsoncpp-dev libeigen3-dev libcurl4-openssl-dev \
libtins-dev libpcap-dev libglfw3-dev libglew-dev
Next:
unzip ~/Downloads/ouster_example-master.zip
mv ouster_example-master ~/packages_carmen/ouster_example-master
cd ~/packages_carmen/ouster_example-master
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_VIZ=ON -DBUILD_PCAP=ON -DBUILD_EXAMPLES=ON ..
make
sudo make install

Install Porcupine

 cd ~/packages_carmen
 git clone https://github.com/Picovoice/Porcupine.git

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”.

(Perform this step ONLY if you are going to work with the road_mapper, otherwise, you can ignore it, as this step may break the Carmen installation) 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        (See below before proceeding)

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

Mapa Volta Da Ufes Atualizado

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)

Create data folder with permission:

sudo mkdir /dados
sudo chmod -R 777 /dados

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.

Clone this wiki locally