Skip to content

Installing Carmen LCAD on Ubuntu 12.04.3 (English)

Rafael Fracalossi edited this page Jun 11, 2024 · 1 revision

Update apt:

sudo apt-get update

Install subversion, git, gimp, meld, and vim:

sudo apt-get install gimp meld subversion vim git

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

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

Download MAE through git:

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

Install the packages for Carmen on 12.04:

sudo apt-get install swig \
libgtk2.0-dev \
qt-sdk \
libqt3-mt libqt3-mt-dev qt3-dev-tools \
libimlib2 libimlib2-dev \
imagemagick libmagick++-dev \
libwrap0 libwrap0-dev tcpd \
libncurses5 libncurses5-dev \
libgsl0-dev libgsl0ldbl \
libdc1394-22 libdc1394-22-dev libdc1394-utils \
cmake \
libgtkglext1 libgtkglext1-dev \
libgtkglextmm-x11-1.2-0 libgtkglextmm-x11-1.2-dev \
libglade2-0 libglade2-dev \
freeglut3 freeglut3-dev \
libcurl3 libcurl3-nss libcurl4-nss-dev \
libglew1.5 libglew1.5-dev libglewmx1.5 libglewmx1.5-dev glew-utils1.5 \
libkml0 libkml-dev \
liburiparser1 liburiparser-dev \
git \
libusb-1.0-0 libusb-1.0-0-dev libusb-dev \
libxi-dev libxi6 \
libxmu-dev libxmu6 \
build-essential libforms-dev \
byacc \
flex \
doxygen \
libespeak-dev

In case of an error with libcheese-gtk23, install the packages below before the previous ones (Solution not confirmed):

sudo apt-get install libglew-dev libcheese7 libcheese-gtk23 libclutter-gst-2.0-0 libcogl15 libclutter-gtk-1.0-0 libclutter-1.0-0

Install Java:

Note: If you want to use the most updated version of Java for personal use, replace oracle-jdk7-installer with oracle-java8-installer.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update && sudo apt-get install oracle-jdk7-installer
update-alternatives --display java

Edit the file /etc/environment:

sudo gedit /etc/environment

Add to the end of the file (if you installed java8, change the end from java-7-oracle to java-8-oracle):

JAVA_HOME=/usr/lib/jvm/java-7-oracle

Install Eclipse:

Download Eclipse from: www.eclipse.org/downloads/

Unzip Eclipse

cd Downloads/
sudo mv eclipse-cpp-kepler-R-linux-gtk-x86_64.tar.gz  /opt
cd /opt/
sudo tar -xvf eclipse-cpp-kepler-R-linux-gtk-x86_64.tar.gz

Create a desktop file and edit it in /usr/share/applications:

sudo gedit /usr/share/applications/eclipse.desktop

Put the following content:

[Desktop Entry]
Name=Eclipse
Type=Application
Exec=/opt/eclipse/eclipse
Terminal=false
Icon=/opt/eclipse/icon.xpm
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE
Name[en]=Eclipse

Install the dependencies of PCL:

sudo apt-get install libeigen3-dev libboost-all-dev libflann-dev libvtk5-dev cmake-gui

Install the dependencies of OpenCV:

sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff4-dev libjasper-dev \
libopenexr-dev cmake python-dev python-numpy python-tk libtbb-dev libeigen2-dev yasm libfaac-dev \
libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev \
libqt4-dev libqt4-opengl-dev sphinx-common texlive-latex-extra libv4l-dev libdc1394-22-dev \
libavcodec-dev libavformat-dev libswscale-dev

Download the files:

sudo su
cd /usr/local/

wget http://bullet.googlecode.com/files/bullet-2.78-r2387.tgz
  ou
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/opencvlibrary/opencv-unix/2.4.9/opencv-2.4.9.zip
wget http://downloads.sourceforge.net/project/fann/fann/2.2.0/FANN-2.2.0-Source.tar.gz
wget http://www.kvaser.com/software/7330130980754/V5_3_0/linuxcan.tar.gz
tar -xvf bullet-2.78-r2387.tgz
unzip opencv-2.4.9.zip
tar -xvf linuxcan.tar.gz
tar -xvf FANN-2.2.0-Source.tar.gz
mv bullet-2.78 bullet
cd bullet
./configure
make
make install
cd ..
cd linuxcan
make
make install
cd ..
cd FANN-2.2.0-Source
mkdir build
cd build
cmake ..
make
make install
cd ../..
cd opencv-2.4.9
mkdir build
cd build
cmake -D WITH_TBB=ON -D WITH_CUDA=OFF -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
make
make install

Edit the file /etc/ld.so.conf.d/opencv.conf:

gedit /etc/ld.so.conf.d/opencv.conf

Add to the end of it:

/usr/local/lib

Run:

ldconfig

Edit the file /etc/bash.bashrc:

gedit /etc/bash.bashrc

Add to the end of the file:

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH

Exit root:

exit

Add to the .bashrc file:

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

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

Install imlib and flycapture packages:

cd $CARMEN_HOME/ubuntu_packages/
sudo dpkg -i imlib_1.9.15-20_amd64.deb 
sudo dpkg -i imlib-devel_1.9.15-20_amd64.deb
tar -xvf flycapture2-2.5.3.4-amd64-pkg.tgz
cd flycapture2-2.5.3.4-amd64/
sudo apt-get install libglademm-2.4-1c2a
sudo apt-get install libglademm-2.4-dev
sudo apt-get install libgtkmm-2.4-dev
sudo sh install_flycapture.sh

Create symbolic link:

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 PCL:

sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl
sudo apt-get update
sudo apt-get install libpcl-all

Install Kinect camera:

sudo su
cd /usr/local
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
make install

If there is an error with the installation above, try installing udev-dev first

sudo apt-get install libudev-dev

mkdir /usr/local/tplib
cd /usr/local/tplib
git clone git://github.com/OpenKinect/libfreenect.git
cd libfreenect
mkdir build
cd build
cmake ..
cp src/libfreenect.pc /usr/local/tplib/
make
cp ../src/libfreenect.pc.in src/libfreenect.pc 
cp ../fakenect/fakenect.sh.in fakenect/fakenect.sh
make install
ldconfig /usr/local/lib64/
exit

Run:

glview

In case of an error, try:

freenect-glview

If there is an error,run:

sudo ldconfig /usr/local/lib64/

Installation of the library G2O :

sudo apt-get install cmake libsuitesparse-dev libqt4-dev qt4-qmake libqglviewer-qt4-dev
cd /usr/local/
sudo svn co https://svn.openslam.org/data/svn/g2o
cd /usr/local/g2o/trunk/build/
sudo cmake ../ -DBUILD_CSPARSE=ON -DG2O_BUILD_DEPRECATED_TYPES=ON -DG2O_BUILD_LINKED_APPS=ON
sudo make
sudo make install

Install the MAE libraries:

apt-get install make g++ freeglut3-dev byacc libforms-dev libtiff4-dev libXi-dev libXmu-dev doxygen tcsh flex libdc1394-22-dev

Compile the MAE: Prerequisite: The environment variables MAEHOME and PATH must be set correctly.

Navigate to the MAE directory: “cd $MAEHOME”.

Compile the MAE: “make”.

Check if the MAE library libnet_conn.a has been generated in MAEHOME/lib.

Check if the MAE compiler netcomp has been generated in MAEHOME/bin.

More information about MAE:

http://www.lcad.inf.ufes.br/wiki/index.php/M%C3%A1quina_Associadora_de_Eventos_-_MAE#Compilando_a_MAE

Installation of dlib:

cd /usr/local
sudo su
git clone https://github.com/davisking/dlib.git
cd dlib/
mkdir build
cd build/
cmake .. {Vai reclamar de coisas CUDA. Mas pode compilar sem suporte a CUDA}
make
make install

Close all terminals and do:

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

Before compiling CARMEN, we need the tracker module to be compiled separately for the navigator_spline to work:

cd $CARMEN_HOME/src/tracker
make

There will be a compilation error, but everything is okay.

To compile CARMEN, run:

cd $CARMEN_HOME/src
make

If an error occurs due to libusb.h, go to the file:

sudo vim /usr/local/include/libfreenect.hpp

And change #include <libusb.h> to

#include <libusb-1.0/libusb.h>

Adjustments for IARA

To configure OpenJAUS, follow the tutorial at:

$CARMEN_HOME/sharedlib/OpenJAUS/README_ALBERTO.txt

To configure the GPS and XSENS automatically when connected to the USB ports, copy the following file from the Carmen data directory to your machine:

cd $CARMEN_HOME/data
sudo cp 99-usb-serial.rules /etc/udev/rules.d/

Adjustments in the network for the GPS Trimble

To connect the new GPS Trimble, it’s necessary to have an Internet connection within the IARA. We opted to use an iPhone with a 3G connection.

For the iPhone to work on Ubuntu 12.04, several steps are required… We lost the history, but you can find the steps on the Internet (Google “iPhone 4S ubuntu 12.04 mount”). You need to install some packages (apt-get install …). If you succeed, you’ll be able to use the iPhone as a Personal Hotspot, meaning you can use the Internet from within the IARA.

Once that’s done, you need to create a Gateway from the machine that has Internet access (car01) to a subnet of the IARA (192.168.0.0 - the Car Network subnet). To do this (see reference page at help.ubuntu.com/community/Internet/ConnectionSharing (Gateway set up)), assuming the iPhone is on eth2 and the IARA subnet is on eth1:

sudo iptables -A FORWARD -o eth2 -i eth1 -s 192.168.0.0/24 -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -t nat -F POSTROUTING
sudo iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
sudo iptables-save | sudo tee /etc/iptables.sav

The commands above create a NAT from the iPhone to the IARA subnet. Next, you need to edit /etc/rc.local and add the following line before “exit 0”:

iptables-restore < /etc/iptables.sav

Additionally, you need to run:

sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"

To make this change permanent, include the following lines in /etc/sysctl.conf:

net.ipv4.ip_forward=1
net.ipv4.conf.default.forwarding=1
net.ipv4.conf.all.forwarding=1

In the Network Manager, you need to set “Use this connection only for resources on its network” (Network Manager->IPv4 Settings->Routes) for all wired networks except for the iPhone’s.

That’s it!

Clone this wiki locally