Install on (K)UBUNTU: Difference between revisions

From Rsewiki
Line 6: Line 6:
On 64-bit Ubuntu, Mobotware compiles, runs and is tested to some extend.
On 64-bit Ubuntu, Mobotware compiles, runs and is tested to some extend.


==UBUNTU version 10.4/10.10/11.04/11.10/12.04/12.10==
==UBUNTU version 10.4/10.10/11.04/11.10/12.04==


This description is valid for UBUNTU, KUBUNTU and XUBUNTU
This description is valid for UBUNTU, KUBUNTU and XUBUNTU
Line 70: Line 70:
  #include <boost/typeof/std/locale.hpp>
  #include <boost/typeof/std/locale.hpp>


====Ubuntu 13.04 32/64-bit - BOOST compile fails====
====Ubuntu 12.10/13.04/13.10 32/64-bit - BOOST compile fails====


p.t. (may 2013) boost do not compile using GCC-4.7, as is default on 64 bit (ubuntu 13.04)
p.t. (may 2013) boost do not compile using GCC-4.7, as is default on 64 bit (ubuntu 13.04)

Revision as of 16:00, 10 April 2014

This is intended as a guidance to install MOBOTWARE

The platform tested is KUBUNTU, UBUNTU and XUBUNTU.

All robots run - for now - 32-bit LINUX distributions and thus tested much more than 64-bit. On 64-bit Ubuntu, Mobotware compiles, runs and is tested to some extend.

UBUNTU version 10.4/10.10/11.04/11.10/12.04

This description is valid for UBUNTU, KUBUNTU and XUBUNTU

  • From version 11.04 of UBUNTU, KUBUNTU or XUBUNTU there is no support for USB-webcam using campool plug-in. The plugin "auv4lgst" is the replacement for USB-webcams supported by gstreamer (most modern webcams))
  • Preferred version is (K)Ubuntu 12.04 32 bit for Mobotware version >=2.1912 - with only a few outstanding issues (e.g. RTEA).

After successfully installing KUBUNTU, UBUNTU or XUBUBTU, install the following packages

e.g. install a package from the command-prompt like:

sudo apt-get install cmake

Needed packages:

- subversion (if you have access to source on SVN)
- gcc
- g++
- cmake
- doxygen  (for documentation only)
- libopencv-dev (ubuntu from 12.4, for earlier versions of ubuntu: try load libhighgui-dev and libcv-dev instead)
- libopencv-gpu-dev
- libraw1394-dev
- libdc1394-22-dev
- libpng-dev
- libexpat-dev
- ncurses-dev
- libpci-dev
- libreadline-dev
- libsdl-dev
- bison (for MRC)
- libudev-dev
- icedtea-plugin  (to run MARG)
- libusb-dev (MUST be version 1.0.3 or better - (used for Kinect only (see note))
- ffmpeg (video codex etc.)
- libv4l-dev (video usage)
- putty (useful serial terminal emulator)
- kdevelop or eclipse (integrated development environment - not strictly needed (and not with XUBUNTU))
- lsof (to track open files - also device files)
- libboost-dev (used by aulocalizer plug-in, but also included in libpcl)
- libboost-system-dev
- python-dev  (can p.t. do without)
- libpcl-all-dev  (see PCL-note)
- libgstreamer0.10-dev (for client and camera interface)

Packages to compile AVR-C - e.g. motor controller and labyrinth

- gcc-avr 
- binutils-avr 
- avr-libc

PCL

The Point Clouds Library (PCL) is in a separate ubuntu repository, so see the instructions on: http://pointclouds.org/downloads/linux.html

At the moment Mobotware does not compile when you install version 1.7. Install version 1.6 instead.

Boost

locale.hpp not found

In some cases compile of auviewer fails complaining that boost/locale.hpp is not found.

changed in source file (in auviewer), from

#include <boost/locale.hpp>

to

#include <boost/typeof/std/locale.hpp>

Ubuntu 12.10/13.04/13.10 32/64-bit - BOOST compile fails

p.t. (may 2013) boost do not compile using GCC-4.7, as is default on 64 bit (ubuntu 13.04) --update (august 2013) on clean install of Ubuntu 13.04 32 bit the problem is the same.

So use update-alternatives to switch to gcc-4.6

sudo update-alternatives --config gcc
sudo update-alternatives --config g++

if update-alternatives has no alternatives, then add them (taken from from http://askubuntu.com/questions/26498/choose-gcc-and-g-version)

Install compiler version 4.6 (assumint 4.7 is installed):

sudo apt-get install gcc-4.6 g++-4.6 cc-4.6

Install Alternatives

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 20

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.7 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 20

sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --set cc /usr/bin/gcc

sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
sudo update-alternatives --set c++ /usr/bin/g++

Configure Alternatives

sudo update-alternatives --config gcc
sudo update-alternatives --config g++

libboost

There is a problem during compilation of the plugin auviewer. To solve this problem locate the following file:

 /usr/include/boost/thread/exceptions.hpp
 

Add the following code at line 11

 //added by Jens Christian Andersen and Claes Jaeger for MobotWare to compile auviewer-plugin
 //ubuntu 13.04(32bit), gcc 4.6 (downgrade from 4.7 - see rsewiki.elektro.dtu.dk), libboost 1.49
 //produces errors when compiling, because of the attributes defines somewhere else in boost. 
 //the consequences for this hack has not been investigated, the compiled plugin has been tested and is working.
 #define BOOST_SYMBOL_VISIBLE

As stated in the comments, the consequences have not been investigated, but so far it is working. Please notify us if you experince any problems because of this hack.

OpenNI

OpenNI is not used by mobotware (mobotware uses the freenect driver), but part of some of the examples in the PCL library uses the OpenNI driver.

Install openNI driver for Kinect requires additional packages:

  • freeglut3-dev (3D graphics with openGL API)
  • sun-java6-jdk (required to compile openNI - sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner" and apt-get update

LIBUSB-1.0.x

For distributions older than 12.04:

See http://www.libusb.org/wiki/libusb-1.0, one way is to install from git-source.

If you installed libusb from

git clone git://git.libusb.org/libusb.git 

then default is verbose logging to console (may have changed since i tryed it (ultimo 2011)). One way to remove is to edit the configure script:

in the file configure find and remove these two lines (about line 770):
enable_log
enable_debug_log

Then run - as usual:

./configure
make
sudo make install

Freenect LIB

Latest version requires this packages:

  • libxmu-dev
  • libxi-dev

To compile from git source - not needed in mobotware

openCV (and ROS) issues

OpenCV in ubuntu 12.4 is version 2.3.1, and opencv-2.1 is not directly available in the for from openCV-1.0.

- ROS replaces default versions of OPENCV.

Installation of ros on ubuntu (kubuntu) see http://www.ros.org/wiki/electric/Installation/Ubuntu The first part about adding source repository and "sudo apt-get update" is fine for installing openCV version 2.3.1 (sudo apt-get install libopencv2.3-dev) too. The same is probably true for the linear algebra template library (sudo apt-get install libeigen3-dev).

ROS electric installes (pt) openCV version 2.3.1, and this includes a pkg-config file with errors, all link directives "-l" includes the full path, which is a syntax error, so

edit the "Libs:" part of /usr/lib/pkgconfig/opencv-2.3.1.pc

from:

# Package Information for pkg-config
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir_old=${prefix}/include/opencv-2.3.1/opencv
includedir_new=${prefix}/include/opencv-2.3.1
Name: OpenCV
Description: Open Source Computer Vision Library
Version: 2.3.1
Libs:  -l${exec_prefix}/lib/libopencv_contrib.so.2.3.1 -l${exec_prefix}/lib/libopencv_legacy.so.2.3.1 \
   -l${exec_prefix}/lib/libopencv_objdetect.so.2.3.1 -l${exec_prefix}/lib/libopencv_calib3d.so.2.3.1 \
   -l${exec_prefix}/lib/libopencv_features2d.so.2.3.1 -l${exec_prefix}/lib/libopencv_video.so.2.3.1 \
   -l${exec_prefix}/lib/libopencv_highgui.so.2.3.1 -l${exec_prefix}/lib/libopencv_ml.so.2.3.1 \
   -l${exec_prefix}/lib/libopencv_imgproc.so.2.3.1 -l${exec_prefix}/lib/libopencv_flann.so.2.3.1 \
   -l${exec_prefix}/lib/libopencv_core.so.2.3.1
Cflags: -I${includedir_old} -I${includedir_new}


to:

# Package Information for pkg-config
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir_old=${prefix}/include/opencv-2.3.1/opencv
includedir_new=${prefix}/include/opencv-2.3.1
Name: OpenCV
Description: Open Source Computer Vision Library
Version: 2.3.1
Libs:  -lopencv_contrib -lopencv_legacy -lopencv_objdetect -lopencv_calib3d \
       -lopencv_features2d -lopencv_video -lopencv_highgui -lopencv_ml \
       -lopencv_imgproc -lopencv_flann -lopencv_core
Cflags: -I${includedir_old} -I${includedir_new}


All relevant Makefiles should now be modified - since SVN version 1768. And updated to detect openCV version 2.1, 2.3.1, and the version installed with ubuntu 12.4.

Thanks to: http://mpt-internal.uni-hohenheim.de/doku.php?id=robotsoftware:mobotware:mobotware-ros

IDE

From an Integrated Development Environment (IDE) all parts of the project can be loaded, compiled and debugged using the provided Makefiles

KDEvelop and Eclipse can be recommended.

(for Eclipse see Remote Development of Mobotware Using Eclipse)

Compile Install Run

Go to the directory with the Mobotware source

Unpack

If from a packed version (see below for SVN source), then

tar -xzf mobotware-3.XXXX.tar.gz

then go to the created directory

cd mobotware-3.XXXX

Compile

From the top level Mobotware directory

make

This is needed even if you are going to compile a plugin only to make needed libraryies. There is (usually) seperate makefiles for each plugin and utility, that can be used once the libraries are in place.

Install

To make the compiled version available on the command line (installed under /usr/local):

  • on a standalobe development computer:
sudo make install
  • On a robot you cam make a local version, that can be selected using "switchtool". (reverts back to default version after a reboot)
sudo make install VER=2012z
  • For a new release on our fileserver (for VIP users on kalman only). This exports Mobotware files to a new directory, compiles all needed files, and copies binary files to e.g. "kalman:/opt/smr.2012m". this directory must exist on kalman (usually created as a copy from a previous version).
./exportMobotware     (and type in the SVN revision number, that is used in filenames, e.g. 62)
cd mobotware-3.62
make kalman VER=2012m

Run

Further set PATH and LD_LIBRARY_PATH inmake add the following lines to ~/.bashrc (or /etc/bash.bashrc)

export PATH=$PATH:/home/jca/svn/build/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/jca/svn/build/lib

(restart your terminal to put the lines into effect)

Maintain SVN source

New version is fetched from command prompt by:

cd ~/mobotware
svn update

When you have changed a file send it back to the svn-repository from the directory with the file, or one of the parent folders known to svn (svn will ask for a note for the change log):

svn commit

To add a new set of files, just make a new set of source files - preferably in a new directory (inside the mobotware file tree) - and add the new directory by (e.g. called foo):

svn add foo
A         foo
A         foo/Makefile
A         foo/bar.cpp
A         foo/bar.cpp~
A (bin)   foo/bar.o

This adds the directory and all the files in it, if too many files were added the surplus can be removed from add-list by e.g.:

svn reveret foo/bar.cpp~ foo/bar.o

You may let SVN modify a line in the source code with revision number or an iID with update details, by addinf $Rev$ or $Id$ somewhere in the source file, and make this field active by:

svn propset svn:keywords 'Id Revision' foo

Then the additions and changes must be committed to go to the repository (starts an editor for a commit remark)

svn commit

or to skip the step with the remark editor:

svn commit -m "in-line commit remark"

Debug

Using debugger to attach to a running process may fail with the message:

Could not attach debugger:
ptrace: Operation not permitted.

Most likely, it is solved by changing:

ptrace_scope to 0 in /etc/sysctl.d/10-ptrace.conf

Test

(to be continued with test and example instructions)