Install Groovy on the KIPR Link from Source
This page shows how-to install ROS Groovy Galapagos on the KIPR Link robot controller.
This guide shows how-to installing Groovy and its dependencies from source on the KIPR Link.
Contents
- Update the KIPR Link Firmware
- Setup the WIFI and connect to the Link
- Set Date and Time
- Install mke2fs
- Partition the USB Flash Drive
- Format the Data Partition
- Format and Enable the Swap Partition
- Having /usr/local and /opt on the USB device
- Get wget and git with SSL support
- Install Python
- Install setuptools
- Install pip
- Install OpenMPI
- Install Boost
- Install CMake
- Install yaml-cpp
- Install EmPy
- Install nose
- Install TinyXml
- Install Apache Portable Runtime
- Install APR-util
- Install Apache logging services
- Install GTest
- Install netifaces
- Install wstool
- Install rosdep
- Install catkin_pkg
- Install rosinstall_generator
- Build the catkin Packages
- Adapt setup.bash
- Setup the Build Environment
- Create a Catkin Workspace
- Download Packages
- Compile and Install Packages
Setup the KIPR Link
1. Update the KIPR Link Firmware
This step is optional. However you might face some issues if you have another firmware running than 2.0.3 or if you run a modified version of 2.0.3.
To update the firmware to version 2.0.3 follow these instructions.
2. Setup the WIFI and connect to the Link
Boot the Link and enable and setup WIFI in [Settings] > [Network] and connect to a wireless network. Then log in to the Link via SSH. An example for IP 192.168.0.1:
ssh root@192.168.0.1
3. Set Date and Time
Set /etc/localtime to the correct time zome. An example for PST:
root@kovan:~# ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
Set the date and time using the date command. An example for 10/31/2013 2:00 pm
root@kovan:~# date 103114002013 Thu Oct 31 14:00:00 PDT 2013
Note: Switching off the KIPR Link will reset the system time so you have to set it again.
Prepare the USB Flash Drive
The KIPR Link doesn't provide neither enough on-board memory nor RAM to compile or store the ROS or its dependencies. We can avoid this limitation by extending the memory with an USB flash drive. This guide is tested with an 8GB drive.
1. Install mke2fs
root@kovan:~# opkg install http://netv.bunnie-bar.com/build/kovan-debug/LATEST/armv5te/e2fsprogs-mke2fs_1.42-r2_armv5te.ipk
2. Partition the USB Flash Drive
We partition the flash drive into a 6GB (used for data) partition and a 2GB partition (used for swap) using cfdisk
root@kovan:~# cfdisk /dev/sda cfdisk (util-linux 2.20.1) Disk Drive: /dev/sda Size: 8004304896 bytes, 8004 MB Heads: 247 Sectors per Track: 62 Cylinders: 1020 Name Flags Part Type FS Type [Label] Size (MB) ------------------------------------------------------------------------------ sda1 Primary Linux 6147.17 sda2 Primary Linux 1857.15*
3. Format the Data Partition
root@kovan:~# mkfs -t ext4 /dev/sda1
4. Format and Enable the Swap Partition
root@kovan:~# mkswap /dev/sda2 root@kovan:~# swapon /dev/sda2
Note: Edit /etc/fstab to permanently enable the swap partition. Be aware that in this case the system will not boot if the USB flash drive is not inserted!
5. Having /usr/local and /opt on the USB device
root@kovan:~# mkdir -p /kovan/media/sda1/usr/local root@kovan:~# ln -s /kovan/media/sda1/usr/local /usr/local root@kovan:~# mkdir -p /kovan/media/sda1/opt root@kovan:~# ln -s /kovan/media/sda1/opt /opt
ROS Prerequisites
1. Get wget and git with SSL support
1.1. Install wget
root@kovan:~# opkg install http://netv.bunnie-bar.com/build/kovan-debug/LATEST/armv5te/wget_1.13.4-r13.1_armv5te.ipk
1.2. Install curl
root@kovan:~# opkg install http://netv.bunnie-bar.com/build/kovan-debug/LATEST/armv5te/libcurl5_7.23.1-r0_armv5te.ipk root@kovan:~# opkg install http://netv.bunnie-bar.com/build/kovan-debug/LATEST/armv5te/curl_7.23.1-r0_armv5te.ipk
1.3. Install CA certificates
root@kovan:~# mkdir -p /etc/ssl/certs
Add the following to the end of file /etc/profile
export SSL_CERT_DIR=/etc/ssl/certs
root@kovan:~# source /etc/profile root@kovan:~# opkg install http://netv.bunnie-bar.com/build/kovan-debug/LATEST/armv5te/openssl-misc_1.0.0g-r15.0_armv5te.ipk root@kovan:~# cd /etc/ssl/certs root@kovan:/etc/ssl/certs# curl http://curl.haxx.se/ca/cacert.pem -o cacert.pem root@kovan:/etc/ssl/certs# awk 'split_after==1{n++;split_after=0} /-----END CERTIFICATE-----/ {split_after=1} {print > "cert" n ".pem"}' cacert.pem root@kovan:/etc/ssl/certs# for file in *.pem; do ln -s $file `openssl x509 -hash -noout -in $file`.0; done root@kovan:/etc/ssl/certs# cd ~
1.4. Install git
root@kovan:~# opkg install http://netv.bunnie-bar.com/build/kovan-debug/LATEST/armv5te/git_1.7.7-r2_armv5te.ipk root@kovan:~# git config --global http.sslcainfo /etc/ssl/certs/cacert.pem
2. Install Python
root@kovan:~# wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz root@kovan:~# tar xf Python-2.7.3.tgz root@kovan:~# cd Python-2.7.3/ root@kovan:~/Python-2.7.3# ./configure root@kovan:~/Python-2.7.3# make root@kovan:~/Python-2.7.3# make install root@kovan:~/Python-2.7.3# cd .. root@kovan:~# rm -r Python-2.7.3 root@kovan:~# rm Python-2.7.3.tgz
3. Install setuptools
root@kovan:~# wget https://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg root@kovan:~# sh setuptools-0.6c11-py2.7.egg root@kovan:~# rm setuptools-0.6c11-py2.7.egg
4. Install pip
root@kovan:~# wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py root@kovan:~# python get-pip.py root@kovan:~# rm get-pip.py
5. Install OpenMPI
root@kovan:~# wget http://www.open-mpi.org/software/ompi/v1.6/downloads/openmpi-1.6.3.tar.bz2 root@kovan:~# tar xf openmpi-1.6.3.tar.bz2 root@kovan:~# cd openmpi-1.6.3 root@kovan:~/openmpi-1.6.3# ./configure root@kovan:~/openmpi-1.6.3# make all root@kovan:~/openmpi-1.6.3# make install root@kovan:~/openmpi-1.6.3# cd .. root@kovan:~# rm -r openmpi-1.6.3 root@kovan:~# rm openmpi-1.6.3.tar.bz2
6. Install Boost
root@kovan:~# wget http://downloads.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.gz root@kovan:~# tar xf boost_1_55_0.tar.gz root@kovan:~# cd boost_1_55_0/ root@kovan:~/boost_1_55_0# ./bootstrap.sh --prefix=/usr/local root@kovan:~/boost_1_55_0# cp tools/build/v2/user-config.jam user-config.jam
Add the line
using mpi ;
to the file user-config.jam
root@kovan:~/boost_1_55_0# ./b2 --user-config=user-config.jam root@kovan:~/boost_1_55_0# ./b2 --user-config=user-config.jam install root@kovan:~/boost_1_55_0# cd .. root@kovan:~# rm -r boost_1_55_0 root@kovan:~# rm boost_1_55_0.tar.gz
7. Install CMake
root@kovan:~# wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz root@kovan:~# tar xf cmake-2.8.10.2.tar.gz root@kovan:~# cd cmake-2.8.10.2 root@kovan:~/cmake-2.8.10.2# ./bootstrap root@kovan:~/cmake-2.8.10.2# make root@kovan:~/cmake-2.8.10.2# make install root@kovan:~/cmake-2.8.10.2# cd .. root@kovan:~# rm -r cmake-2.8.10.2 root@kovan:~# rm cmake-2.8.10.2.tar.gz
8. Install yaml-cpp
root@kovan:~# wget http://yaml-cpp.googlecode.com/files/yaml-cpp-0.5.0.tar.gz root@kovan:~# tar xf yaml-cpp-0.5.0.tar.gz root@kovan:~# cd yaml-cpp-0.5.0/build root@kovan:~/yaml-cpp-0.5.0/build# cmake .. root@kovan:~/yaml-cpp-0.5.0/build# make root@kovan:~/yaml-cpp-0.5.0/build# make install root@kovan:~/yaml-cpp-0.5.0/build# cd ../.. root@kovan:~# rm -r yaml-cpp-0.5.0 root@kovan:~# rm yaml-cpp-0.5.0.tar.gz
9. Install EmPy
root@kovan:~# pip install -U empy
10. Install nose
root@kovan:~# pip install -U nose
11. Install TinyXml
root@kovan:~# wget http://iweb.dl.sourceforge.net/project/tinyxml/tinyxml/2.6.2/tinyxml_2_6_2.zip root@kovan:~# unzip tinyxml_2_6_2.zip root@kovan:~# cd tinyxml
Add the lines to the files tinyxml.h and tinystr.h
#ifndef TIXML_USE_STL #define TIXML_USE_STL #endif
Change in the file Makefile
TINYXML_USE_STL := NO
to
TINYXML_USE_STL := YES
root@kovan:~/tinyxml# make root@kovan:~/tinyxml# gcc -shared -o libtinyxml.so *.o root@kovan:~/tinyxml# cp libtinyxml.so /usr/local/lib/ root@kovan:~/tinyxml# cp tinyxml.h /usr/local/include/ root@kovan:~/tinyxml# cp tinystr.h /usr/local/include/ root@kovan:~/tinyxml# cd .. root@kovan:~# rm -r tinyxml root@kovan:~# rm tinyxml_2_6_2.zip
12. Install Apache Portable Runtime
root@kovan:~# wget http://mirror.cc.columbia.edu/pub/software/apache//apr/apr-1.5.1.tar.bz2 root@kovan:~# tar xf apr-1.5.1.tar.bz2 root@kovan:~# cd apr-1.5.1 root@kovan:~/apr-1.5.1# ./configure root@kovan:~/apr-1.5.1# make root@kovan:~/apr-1.5.1# make install root@kovan:~/apr-1.5.1# cd .. root@kovan:~# rm -r apr-1.5.1 root@kovan:~# rm apr-1.5.1.tar.bz2
13. Install APR-util
root@kovan:~# wget http://mirror.cc.columbia.edu/pub/software/apache//apr/apr-util-1.5.3.tar.bz2 root@kovan:~# tar xf apr-util-1.5.3.tar.bz2 root@kovan:~# cd apr-util-1.5.3 root@kovan:~/apr-util-1.5.3# ./configure --with-apr=/usr/local/apr root@kovan:~/apr-util-1.5.3# make root@kovan:~/apr-util-1.5.3# make install root@kovan:~/apr-util-1.5.3# cd .. root@kovan:~# rm -r apr-util-1.5.3 root@kovan:~# rm apr-util-1.5.3.tar.bz2
14. Install Apache logging services
root@kovan:~# wget http://apache.mirrors.hoobly.com/logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.zip root@kovan:~# unzip apache-log4cxx-0.10.0.zip root@kovan:~# cd apache-log4cxx-0.10.0
Add the following line to the files src/main/cpp/inputstreamreader.cpp, src/main/cpp/socketoutputstream.cpp and src/examples/cpp/console.cpp
#include <string.h>
Add the following line to the file src/examples/cpp/console.cpp
#include <stdio.h>
root@kovan:~/apache-log4cxx-0.10.0# chmod u+x configure root@kovan:~/apache-log4cxx-0.10.0# ./configure root@kovan:~/apache-log4cxx-0.10.0# make root@kovan:~/apache-log4cxx-0.10.0# make install root@kovan:~/apache-log4cxx-0.10.0# cd .. root@kovan:~# rm -r apache-log4cxx-0.10.0 root@kovan:~# rm apache-log4cxx-0.10.0.zip
15. Install GTest
root@kovan:~# cd /usr/src/ root@kovan:/usr/src# wget http://googletest.googlecode.com/files/gtest-1.7.0.zip root@kovan:/usr/src# unzip gtest-1.7.0.zip root@kovan:/usr/src# mv gtest-1.7.0 gtest root@kovan:/usr/src# rm -r gtest-1.7.0.zip root@kovan:/usr/src# cd ~
16. Install netifaces
root@kovan:~# pip install -U netifaces
Install ROS Groovy Galapagos
1. Install wstool
root@kovan:~# pip install -U wstool
2. Install rosdep
root@kovan:~# pip install -U rosdep root@kovan:~# rosdep init root@kovan:~# rosdep update
3. Install catkin_pkg
root@kovan:~# pip install -U catkin_pkg
4. Install rosinstall_generator
root@kovan:~# pip install -U rosinstall_generator
5. Build the catkin Packages
5.1. Create a catkin Workspace
root@kovan:~# mkdir /kovan/media/sda1/ros_catkin_ws root@kovan:~# cd /kovan/media/sda1/ros_catkin_ws
5.2. Fetch the core packages with rosinstall_generator and wstool
root@kovan:/kovan/media/sda1/ros_catkin_ws# rosinstall_generator ros_comm --rosdistro groovy --deps --wet-only > groovy-ros_comm-wet.rosinstall root@kovan:/kovan/media/sda1/ros_catkin_ws# wstool init -j8 src groovy-ros_comm-wet.rosinstall
Note: If you get error messages likeError processing <...> Checkout of <...> into <...> failed., try to update the work space with
root@kovan:/kovan/media/sda1/ros_catkin_ws# wstool update -t src/
5.3. Adapt some sources
Change in file src/catkin/cmake/platform/lsb.cmake
execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -si OUTPUT_VARIABLE LSB_DISTRIB_ID OUTPUT_STRIP_TRAILING_WHITESPACE) string(TOUPPER ${LSB_DISTRIB_ID} v) set(${v} TRUE CACHE BOOL "LSB Distrib tag") execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -sd OUTPUT_VARIABLE LSB_DESCRIPTION OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -sr OUTPUT_VARIABLE LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -sc
into
execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -s -i OUTPUT_VARIABLE LSB_DISTRIB_ID OUTPUT_STRIP_TRAILING_WHITESPACE) string(TOUPPER ${LSB_DISTRIB_ID} v) set(${v} TRUE CACHE BOOL "LSB Distrib tag") execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -s -d OUTPUT_VARIABLE LSB_DESCRIPTION OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -s -r OUTPUT_VARIABLE LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -s -c
Change in the file src/rospack/CMakeLists.txt
target_link_libraries(rospack tinyxml ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
to
target_link_libraries(rospack tinyxml ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} dl util)
Change in the file src/ros_comm/roscpp/src/libros/service_server_link.cpp
uint32_t len = *((uint32_t*)(buffer.get() + 1));
to
#if defined(__arm__) || defined(__arm) uint32_t len; memcpy(&len, buffer.get() + 1, sizeof(uint32_t)); #else uint32_t len = *((uint32_t*)(buffer.get() + 1)); #endif
5.4. Compile and Install ROS
root@kovan:/kovan/media/sda1/ros_catkin_ws# ./src/catkin/bin/catkin_make_isolated --install --install-space /opt/ros/groovy -DCMAKE_BUILD_TYPE=Release
5.5. Clean-up
root@kovan:/kovan/media/sda1/ros_catkin_ws# cd .. root@kovan:/kovan/media/sda1# rm -r ros_catkin_ws/ root@kovan:/kovan/media/sda1# cd ~
6. Adapt setup.bash
Add to the file /opt/ros/groovy/setup.bash
export ROS_IP=127.0.0.1 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
Install common_msgs, actionlib and the ros4link Package
1. Setup the Build Environment
root@kovan:~# source /opt/ros/groovy/setup.bash
2. Create a Catkin Workspace
root@kovan:~# mkdir -p ~/catkin_ws/src root@kovan:~# cd ~/catkin_ws/src/ root@kovan:~/catkin_ws/src# catkin_init_workspace
3. Download Packages
root@kovan:~/catkin_ws/src# git clone git://github.com/ros/common_msgs.git root@kovan:~/catkin_ws/src# cd common_msgs/ root@kovan:~/catkin_ws/src/common_msgs# git checkout groovy-devel root@kovan:~/catkin_ws/src/common_msgs# cd .. root@kovan:~/catkin_ws/src# git clone https://github.com/ros/actionlib.git root@kovan:~/catkin_ws/src# cd actionlib/ root@kovan:~/catkin_ws/src/actionlib# git checkout groovy-devel root@kovan:~/catkin_ws/src/actionlib# cd .. root@kovan:~/catkin_ws/src# git clone https://code.google.com/p/ros4link.wrapper/ root@kovan:~/catkin_ws/src# mv ros4link.wrapper/* ./ root@kovan:~/catkin_ws/src# rm -r ros4link.wrapper/
4. Compile and Install Packages
root@kovan:~/catkin_ws/src# cd .. root@kovan:~/catkin_ws# catkin_make -DCMAKE_INSTALL_PREFIX=/opt/ros/groovy install