ROS Robotic operation system

Installation of ROS Fuerte

Binary installation of Fuerte for Ubuntu 12.04 or older or debian http://www.ros.org/wiki/fuerte/Installation/Ubuntu

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu precise main" > /etc/apt/sources.list.d/ros-latest.list'
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
sudo apt-get update
# full install (currently always needed)
sudo apt-get install ros-fuerte-desktop
echo "source /opt/ros/fuerte/setup.bash" >> ~/.bashrc

Restart the console so that the changes to .bashrc become active.

Installation from source: http://www.ros.org/wiki/orocos_toolchain_ros

mkdir $HOME/rosstacks
echo "export ROS_PACKAGE_PATH=\$ROS_PACKAGE_PATH:\$HOME/rosstacks" >> ~/.bashrc
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$HOME/rosstacks

Restart the console so that the changes to .bashrc become active.

sudo apt-get install libreadline-dev omniorb omniidl omniorb-nameserver libomniorb4-1 libomniorb4-dev libomnithread3-dev libomnithread3c2 gccxml antlr libantlr-dev libxslt1-dev liblua5.1-0-dev ruby1.8-dev libruby1.8 rubygems1.8 rake ruby-facets ruby-rvm
gem install nokogiri -v '1.5.2' -- --with-xml2-lib=/usr/lib/i386-linux-gnu --with-xml2-include=/usr/include/libxml2 --with-xslt-lib=/usr/lib/i386-linux-gnu --with-xslt-include=/usr/include/libxslt

cd $HOME/rosstacks
git clone http://git.gitorious.org/orocos-toolchain/orocos_toolchain.git
git clone http://git.mech.kuleuven.be/robotics/rtt_ros_integration.git
git clone http://git.mech.kuleuven.be/robotics/rtt_ros_comm.git
git clone http://git.mech.kuleuven.be/robotics/rtt_common_msgs.git
git clone http://git.mech.kuleuven.be/robotics/rtt_geometry.git
cd orocos_toolchain
git checkout orocos_toolchain-2.6.0-2
git submodule init
git submodule update
source env.sh
rosmake orocos_toolchain rtt_ros_integration rtt_ros_comm rtt_common_msgs rtt_geometry

The tools from the binary installation (roscd and rosmake) are needed for the source installation, therefore do the binary installation first.

SOEM drivers

They are needed to interface Ethercat I/O- modules.

They can be optained from: http://git.mech.kuleuven.be/robotics/soem.git

Installation of SOEM drivers for ROS Fuerte

cd ~/rosstacks
git clone http://git.mech.kuleuven.be/robotics/soem.git
rosmake soem

Than follow the description given here: http://www.ros.org/wiki/Industrial/Tutorials/Simple_EtherCAT_Network_IO .

Running the "Hello world" example of OROCOS

First, add the generated env.sh script to the .bashrc file in your home directory:
Append "source ~/rosstacks/orocos_toolchain/env.sh" -- without the quotes -- to the end of your .bashrc file.

Restart the console so that the changes to .bashrc become active.

Now enter:

cd rosstacks
rosrun ocl orocreate-pkg HelloWorld
cd HelloWorld
make

This should build the HelloWorld package.

Testing the "Hello world" example

Write a script "helloworld.ops" with the following content:

require("print") 
import("HelloWorld") 
print.ln("Script imported HelloWorld package:")
displayComponentTypes() 
loadComponent("Hello", "HelloWorld") 
print.ln("Script created Hello Component with period: " + Hello.getPeriod() )

Execute the script with the command:

deployer-gnulinux -s helloworld.ops -linfo

Now you should be able to follow the "Hello World" tutorial of the following document: orocos-components-manual.pdf

Adding the QT libraries

See: http://qt-project.org/quarterly/view/using_cmake_to_build_qt_projects

First step: Add the following lines to the CMakeLists.txt file:

find_package(Qt4 REQUIRED)
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})

All changes for including the a library with the name utils.cpp:

...
##### FOR QT 01 of 04 #####
find_package(Qt4 REQUIRED)
SET(QT_USE_QTNETWORK TRUE)
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})

##### FOR QT 02 of 04 #####
include_directories(../../00AssetLib/Utils)

# Creates a component library libSensorTask-<target>.so
# and installs in the directory lib/orocos/SensorTask/
#
orocos_component(SensorTask src/SensorTask-component.hpp src/SensorTask-component.cpp

##### FOR QT 03 of 04 #####
../../00AssetLib/Utils/utils.cpp) # ...you may add multiple source files

##### FOR QT 04 of 04 #####
TARGET_LINK_LIBRARIES(SensorTask ${QT_LIBRARIES})
...

In this example the preprocessor is not invoked, because the Utils class is not derived from QObject.

Adding other libraries

Have a look at: http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries

Summary:
Create a folder named cmake/Modules/ under your project root, and in the root CMakeLists.txt, include the following code:

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

At ASSET, TU Delft we use the following line instead:

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../00AssetLib/ROS/cmake/Modules)

Adding ZeroMQ

Download the file FindZeroMQ.cmake (from here) and put it into the folder cmake/Modules.

Now add the following to your CMakeLists.txt file:

find_package(ZeroMQ REQUIRED)
include_directories(${ZeroMQ_INCLUDE_DIR})
set(LIBS ${LIBS} ${ZeroMQ_LIBRARY})

In addition LIBS must be added to TARGET_LINK_LIBRARIES:

TARGET_LINK_LIBRARIES(SensorTask ${QT_LIBRARIES} ${LIBS})

Adding Google Protocol Buffers

Downlad the file FindProtobuf.cmake (from here) and put it into the folder cmake/Modules.

Now add an adapted version of the following example to your CMakeLists.txt file:

#  Example:
#
#   find_package(ProtocolBuffer REQUIRED)
#   include_directories(${PROTOBUF_INCLUDE_DIRS})
#
#   include_directories(${CMAKE_CURRENT_BINARY_DIR})
#   SET(args 
#       PROTOFILES foo.proto 
#       OUTPATH ${CMAKE_CURRENT_SOURCE_DIR}
#   )
#   PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${args})
#   add_executable(bar bar.cc ${PROTO_SRCS} ${PROTO_HDRS})
#   target_link_libraries(bar ${PROTOBUF_LIBRARY})
#
# NOTE: You may need to link against pthreads, depending
# on the platform.

UNTESTED !!!

Using Qt creator to develop OROCOS packages

Install QT creator 2.5.2 on 32 bit Linux

cd ~
wget http://origin.releases.qt-project.org/qtcreator/2.5.2/qt-creator-linux-x86-opensource-2.5.2.bin
chmod +x qt-creator-linux-x86-opensource-2.5.2.bin
sudo ./qt-creator-linux-x86-opensource-2.5.2.bin

Edit the qtcreator.sh start script

cd /opt/qtcreator-2.5.2/bin
sudo joe qtcreator.sh

Add the following lines at the beginning and remove the old #!/bin/sh line at the top:

source /opt/ros/fuerte/setup.bash
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$HOME/rosstacks:$HOME/00QT-Software/WinchController
source $HOME/rosstacks/orocos_toolchain/env.sh

Add the following bash script to your project (here: SensorTask):

deployer-gnulinux -s runTasks.ops

Add this script as "Run" target to your project in QT-Creator. Also set the execution directory to match the main directory of your orocos component, e.g. $HOME/00QT-Software/WinchController/SensorTask

Add the following OROCOS script to your project (here: SensorTask):

require("print")
import("SensorTask")
loadComponent("Sensor", "SensorTask")
Sensor.configure
Sensor.setPeriod(1)
print.ln("Script created Sensor Component with period: " + Sensor.getPeriod() )
Sensor.start()

This needs to be adapted to match the needs of your project.

Add a "Run" target to your project in QT-Creator.


Back to FrontPage

KielTech: ROS (last edited 2012-12-20 19:40:51 by UweFechner)