Youbot lissajous tracing tutorial (ERF2012)

Summary

This tutorial explains how to create an application to trace a Lissajous figure with a Kuka Youbot, starting from existing packages (itasc_core, robots, tasks, solvers, trajectory generators...). The tutorial consists of a laser tracing task with a non-cartesian Virtual Kinematic Chain (a chain including the distance along the laser), a cartesian_motion task for the movement to the initial pose and joint limit avoidance. The higher level FSM (composite_task_fsm.lua) allows to switch easily settings, enabling a better understanding of some basic iTaSC principles. The tutorial was given as a hands-on workshop on the European Robotics Forum 2012, accompanied by these slides .

Installation

Ubuntu Installation with ROS Electric

Installation instructions

Ubuntu 12.04 Installation with ROS Fuerte

  • Install Fuerte ROS using Debian packages for Ubuntu Precise (12.04) or later. In case you don't run Ubuntu you can use the ROS install scripts. See the ros installation instructions.
  • Make sure the following debian packages are installed:

sudo apt-get install ros-fuerte-pr2-controllers
sudo apt-get install ros-fuerte-pr2-simulator

  • Create a directory in which you want to install all the demo source (for instance erf)

mkdir ~/erf

  • Add this directory to your $ROS_PACKAGE_PATH

export ROS_PACKAGE_PATH=~/erf:$ROS_PACKAGE_PATH

  • Get rosinstall

sudo apt-get install python-setuptools
sudo easy_install -U rosinstall

  • Get the workshop's rosinstall file . Save it as erf_fuerte.rosinstall in the erf folder.
  • Run rosinstall

rosinstall ~/erf erf_fuerte.rosinstall /opt/ros/fuerte/

  • As the rosinstall tells you source the setup script

source ~/erf/setup.bash

  • Install all dependencies (ignore warnings)

rosdep install itasc_examples
rosdep install rFSM

Setup

  • Add the following functions in your $HOME/.bashrc file:

useERF(){
    source $HOME/erf/setup.bash;
    source $HOME/erf/setup.sh;
    source `rosstack find orocos_toolchain`/env.sh;
    setLUA;
}
 
setLUA(){
    if [ "x$LUA_PATH" == "x" ]; then LUA_PATH=";;"; fi
    if [ "x$LUA_CPATH" == "x" ]; then LUA_CPATH=";;"; fi
    export LUA_PATH="$LUA_PATH;`rospack find rFSM`/?.lua"
    export LUA_PATH="$LUA_PATH;`rospack find ocl`/lua/modules/?.lua"
    export LUA_PATH="$LUA_PATH;`rospack find kdl`/?.lua"
    export LUA_PATH="$LUA_PATH;`rospack find rttlua_completion`/?.lua"
    export LUA_PATH="$LUA_PATH;`rospack find youbot_driver_rtt`/lua/?.lua"
    export LUA_PATH="$LUA_PATH;`rospack find kdl_lua`/lua/?.lua"
    export LUA_CPATH="$LUA_CPATH;`rospack find rttlua_completion`/?.so"
    export PATH="$PATH:`rosstack find orocos_toolchain`/install/bin"
}
 
useERF

Make

Compile the workshop sources
rosmake itasc_erf2012_demo

The tutorial

see these slides

List of all tasks/motions to be executed

Draw the kinematic loops for each task

Draw the behavior of the application at runtime

Create or download all necessary packages

Create the FSM on the iTaSC level

Create the FSM on the application level

Check, create or adapt the configuration files of your components

Create a deploy script

Create the FSMs that coordinate the behavior at runtime

Execution of the solution of the tutorial

Execution

Gazebo simulation

  • Open a terminal and run roscore

roscore
  • Open another terminal and launch an empty gazebo world

roslaunch gazebo_worlds empty_world.launch
  • Open another terminal and go to the itasc_erf_2012 package:

roscd itasc_erf2012_demo/
  • Run the script that starts the gazebo simulator (and two translator topics to communicate with the itasc code)

./run_gazebo.sh

  • Open another terminal and go to the itasc_erf_2012 package:

roscd itasc_erf2012_demo/
  • Run the script that starts the itasc application

./run_simulation.sh
  • Look for the following output:

itasc fsm: STATE ENTER
root.NONemergency.RunningITASC.Running
[cartesian generator] moveTo will start from

Real youbot

  • Make sure that you are connected to the real youbot.
  • Open another terminal and go to the itasc_erf_2012 package:

roscd itasc_erf2012_demo/
  • Check the name of the network connection with the robot (for instance eth0) and put this connection name in the youbot_driver cpf file (cpf/youbot_driver.cpf)
  • Run the script that starts the itasc application

./run.sh
  • Look for the following output:

itasc fsm: STATE ENTER
root.NONemergency.RunningITASC.Running
[cartesian generator] moveTo will start from

Command the robot

Interact with the iTaSC level FSM @ runtime by sending events to it. There are two ways to do so:
  • One way is to send events in the Orocos task browser through the event_firer component.
    • To send an event, e.g. "e_my_event", type in the Task Browser:

event_firer.itasc_common_events_in.write("e_my_event")
    • Possible events (as indicated on the composite_task_fsm scheme)
      • e_start_tracing: start tracing the figure, default: z off, rot on, penalize base
      • e_toggle_robot_weights: toggle between penalize base and penalize arm
      • e_toggle_z_constraint: toggle between z off and z on
      • e_toggle_rot_constraint: toggle between rot off and rot on
  • (RECOMMENDED) Another, more user-friendly way, is to send events on the /itasc/ ros_common_events_in ROS topic. This can also be used in a graphical way, by using the run_eventgui.sh executable. It launches a QT based GUI that uses the configuration files in the launch directory. It will show the possible events to interact with the application as clickable buttons. You'll need to download the following code in order to use this GUI: https://bitbucket.org/apertuscus/python_gui

FAQ

  • I get the message "starting from" (a unity matrix) and the simulated robot doesn't move
    • In the new Youbot model, the /odom topic changed to /base_odometry/odom, this is adapted on the master branch, or change it manually in the run_simulation.ops file. You can check whether this is causing the problem by reading the youbot.q_from_base port and checking if it returns "NoData".
  • I get the error "[PropertyLoader:configure] The type 'KDL.JntArray' did not provide a type composition function, but I need one to compose it from a PropertyBag."

54398d0653067580edd5c5ec66bda5eac0aa29e4 and 81e5fab65ee3587056a4d5fda4eb5ce796082eaf