In this tutorial we will show you how to programs robot behaviour on using Live Robot Programming over PhaROS.

Setup

  1. Follow the steps 1 to 4 of this post.
  2. Create a ROS node that consumes /kompai2/pose and /kompai/scan and publish in /command_velocity. To do this, just executing this:

    LrpharosPackage uniqueInstance
    
  3. Create an instance of the RobulabBridge class

    RobulabBridge uniqueInstance
    
  4. To assure that everything is fine, inspect the instance of RobulabBridge and check that its instance variable laserData is not nil and its values change over the time.
  5. Open the LRP UI by right-clicking the World and selecting Live Robot Programming.

Stop when an obstacle is detected

  1. Ok, so now we can start writing the behavior. First we will need some variables, those are: robulab to manage the robot and some constants such as: f_vel as linear velocity, t_vel for angular velocity, and min_distance as the minimum distance between the robot and an obstacle.

    (var robulab := [RobulabBridgr uniqueInstance ])
    (var min_distance := [0.5])
    (var f_vel := [0.25])
    (var t_vel := [0.5])
    
  2. We define the state machine called Tito.
    What we want to the robot is to go forward unless there is an obstacle in front of it so it should stop and turn to avoid it.
    This could be modelled in a abstractly as two states: forward and avoid.

    (machine Tito
        ;; States
        (state forward
            (onentry [robulab value forward: f_vel value])
        )
        (state stop
            (onentry [robulab value stop])
        )
    
        ;; Transitions
        (on obstacle forward -> stop t-avoid)
        (on noObstacle avoid -> forward t-forward)
    
        ;; Events
        (event obstacle [robulab value isThereAnObstacle: min_distance value])
        (event noObstacle [(robulab value isThereAnObstacle: min_distance value) not])
    )
    
  3. Finally, to run it, just start the machine on the forward state.
    (spawn Tito forward)

  4. The robot should move linearly and stop when detects an obstacle.

Avoiding obstacles

Let’s add an avoiding behavior. A simple one might be turning until it detects there is no obstacle and go forward again.
Then a simple behavior that match the avoidance requisite is:

  • If the obstacle is in the left side of the front: turn right
  • If the obstacle is in the right side of the front: turn left.

RobotBridge provides two methods to detect obstacles on the left and right part of the front of the robot: RobotBridge>>isThereARightObstacle: and RobotBridge>>isThereALeftObstacle:
Then, the idea is to turn left if there is an obstacle in the front-right, or, turn right if there is an obstacle in the front-left.

  1. Add the following states

            (state turnLeft
                (onentry [robulab value turn: t_vel value])
            )
    
            (state turnRight
                (onentry [robulab value turn: t_vel value negated])
            )
    
  2. Add the corresponding transitions

            (on rightObstacle stop -> turnLeft t-lturn)
            (on leftObstacle stop -> turnRight t-rturn)
            (on noObstacle turnLeft -> stop t-tlstop)
            (on noObstacle turnRight -> stop t-trstop)
    
  3. And add the events

            (event rightObstacle [robulab value isThereARightObstacle: minDistance value])
            (event leftObstacle [robulab value isThereALeftObstacle: minDistance value])
    
  4. Now the robot will start turning to avoid the obstacle.

Note

Updated version of LRP it is not necessary to add value after a variable.
Then,

    (onentry [robulab value turn: t_vel value negated])

is turned to

    (onentry [robulab turn: t_vel negated])

making it more readable.

Xuan Sang Le is a PhD student who has joined our team mid-february. His work is co-supervized by Ecole des Mines and ENSTA is about speed optimization of Smalltalk robotic software by means of FPGAs. The first step is to develop an application fully in Smalltalk and our PhaROS Robotics framework that will serve as a reference for our metrics. The app we have chosen is a simple tracker robot that follows an object of a particular color. Beside being fun, the result shown by the video below is interesting. As we have initially expected we can’t pretend to be real-time. Still, Pharo is capable of fetching an image through wifi, process it and discover the position of the object 650 milliseconds. And this is with non-optimized code. Figures are likely to be better after optimization.

As i already shout in the FOSDEM 2014 slides post, i have presented PhaROS in the last edition of FOSDEM, under the title of PhaROS: Towards Live Environments in Robotics.

I bring now to you this video taken during the presentation. I wish you to enjoy it!

Sorry if my hair is disheveled :), i am not very photogenic.

http://mirror.as35701.net/video.fosdem.org/2014/K4401/Saturday/PhaROS.webm

 

Enjoy it!

 

 

 

PhaROS has being in this last edition of FOSDEM (2014) we are proud to share our time and space with a lot of open source projects. Thank you very much for good feelings, feedback and sharing this amazing time.
Video and photos from this great event will be soon available here. Meanwhile, here are the slides

Keep tuned!

PhaROS tool has the mission of installing and creating packages into a ROS installation.

For doing this we have several commands, from installing and creating to administrating repositories, so you can manage your own packages and creating templates without major problems.

Install PhaROS tool

We are working for having this package in Ubuntu and ROS repositories, but meanwhile you can download it from here: pharos-deb

Once downloaded just execute

sudo dpkg -i pharos.deb

pharos –help

 

Install PhaROS based Package

pharos install PACKAGE [OPTIONS]

Example

pharos install esug –location=/home/user/ros/workspace –version=2.0

Help

pharos install –help

 Create PhaROS based Package

pharos create PACKAGE [OPTIONS]

Example

pharos create –location=/home/user/ros/workspace –version=2.0 –author=YourName –author-email=YourEmail

Tip: Be sure the email is a correct one. If is not a correctly spelled one you will notice during last step.
Help
pharos create –help

Register Repository of packages

pharos register-repository –url=anUrl –package=aPackage [ OPTIONS ]

Example

pharos register-repository –url=http://smalltalkhub.com/mc/user/YourProject/main –package=YourProjectDirectory –directory=YourProjectDirectory

Tip: If your repository requires user/password for reading add –user=User –password=Password to the example.
Disclaimer: User/Password will be stored in a text file without any security.
Help

pharos register-repository –help

Listing registered repositories

pharos list-repositories

Creating a directory for your own project repository

pharos create-repository PACKAGENAME [ OPTIONS ]

Example

pharos create-repository example –user=UserName > directory.st
pharos create-repository example –user=UserName  –output= directory.st

Help

pharos create-repository –help

 

 

 

We are now really glad to present an enhanced way to deal with PhaROS.

Since we want to keep with the ROS community spirit of collaborative development for robotics, we introduce now our own command for managing packages made in PhaROS.

This command is mean to install existing packages and create new packages with cool snippets and examples for going faster through the learning time.

PhaROS tool is made completely in Pharo smalltalk and it allows to deploy an existent package into a pharo 1.4/2.0/3.0 in any distribution of ROS that uses catkin package. It automatize the generation xml, makefiles, type and scripts creation, going on the direction of letting the pharo programmer to focus just in programming and not in infrastructure stuff.

For Installing and Using please check this post: using-pharos-tool

 

 

 

 

 

 

 

Since a bit more than one year of hard work, we are glad to be able to show the world our pharo client framework for ROS.

  ROS (Robot Operating System) provides libraries and tools to help software developers create robot applications. It provides hardware abstraction, device drivers, libraries, visualizers, message-passing, package management, and more. 

In order to make your life easy, we present here a virtualization with all the things needed installed and configured for the Groovy Galapagos version. Sadly, in this version of ROS (the last stable) the Gazebo simulator is not working, and also the most stable code of the previous version (Fuerte) is not working with gazebo anymore. Thats why the examples we show here are based on the easiest ROS simulator, the turtlesim.

We expect to be able to make a better showing up of all this world with the next version (Hydromedusa) which still unstable, but promise to have a whole new way to interact to simulators and so to let us show you a full simulated robot managed from your pharo image.

 

After you have downloaded the virtualization, and import it into your virtualbox installation, you need to get started into this new world. Remind always that currently, ROS is almost managed thought console commands, so, in order to interact with ROS and PhaROS you will need to use it, and of course, in order to use it you need to know some commands.

 

Yeah, cool, but you know, i just want to see something working, and i hate to waste my time understanding commands

So, open a terminal and execute:

rosrun esug pharos turtlesimpharo

 

Ok, you got my attention, i want to know a bit more about how to use ROS 

roscd {package name} ” This command step into the folder of the package ”

roscd esug ” This application will drive you to the esug package folder ”

rosrun { package name } { package-binary-name } { arguments } ” This command execute a binary of a package, generally this means a ROS Node that will have some responsibility”

rosrun esug pharos {script name} “punctually this command will execute a given script. ”
rosrun esug headless { script name } ” this command works like pharos command, but starts with a headless VM. Regard the inspects and halts before use this”
rosrun esug edit ” this command will open the image related without execute anything. This way, each package has its own image, and is easy to point to it and edit or browse it”
In order to change IP/Port of the ROS master, you need to change both, ~/.bashrc file (Changing the Environment variables) and also the constructors used by the scripts.

 

It is there any cheat sheet to have all the commands ? 

Yes of course: right here

 

Ok, i just execute the turtlesimpharo script, nice, there are more examples right? 

yes of course :), here you have an other one a bit more complex

rosrun esug turtlesimpursuitturtles

 

 Yeah! I love it, how do i make my own code?

A great way to begin is browsing PhaROSEsug package, it has commented methods and uses all the basic stuff. We will make some tutorials for advanced usage, but mean while you can have fun with that and browsing code and tests is always allowed ;).

 

 I made roscd esug, and i found a lot of folders! i don’t understand anything!

├── bin
│   ├── edit
│   ├── headless
│   └── pharos
├── build
├── CMakeLists.txt
├── ex.launch
├── image
│   ├── Pharo.changes
│   ├── PharoDebug.log
│   ├── Pharo.image
│   ├── PharoV10.sources
│   └── scripts
│   ├── turtlesimpharo
│   ├── turtlesimpursuitturtles
├── include
├── msg
├── package.xml
├── src
└── vm
└── pharo -> /home/pharos/vm/pharo

 

——————–
bin
——————–
we have the commands to interact with the related package-image

 

——————–
build
——————–
Is here to keep layout compatibility with ROS. Maybe will store package-cache in the future.

——————–
CMakeLists.txt
——————–
ROS give a make tool in order to generate infrastructure code, like the structures related with topic messages. Actually this file should be mantained by hand.
——————–
image
——————–
In this folder we encounter the related image, the common source/changes bundle, and the scripts folder

——————–
image/scripts
——————–

In this folder we have all the scripts that we can run with this package. This files are actually generated and related with script methods in the package-related-object in the image side. (To look for the object of esug package punctually, browse PhaROSEsug ).

 

——————–
include
——————–

This folder is for ROS layout compatibility. We are not currently using this folder.
——————–
msg
——————–
This folder is for message definition files ( .msg extention). This folder is mantained automatically with the type generation from image side, but you can also add your own types with no relation with the image side. In any case, messages and it dependancies should be updated in the ros infraestructure files (CMakeLists.txt, package.xml)
——————–
package.xml
——————–

This is the package description file that ROS use to define compile-time / runtime dependancies, author, etc. You should not worry about this file in any case but in the case of new types definition.

——————–
src
——————–
This folder is for ROS-fuerte layout compatibility. Is actually deprecated and it will be removed soon.
——————–
vm
——————–
This folder has the vm needed to run the exisiting image and code. Commonly is a symbolic link to the VM that the image creator of the package.
This folder and vm are usually pointed by the scripts at the bin folder.

 

 

 

 

 

 

At the ESUG 2013 conference, we presented the current status of the RoboShop project. Santiago did a great job and now we are able to run tests of our scenario of a helper robot  in a shopping mall. Based on a map built using laser SLAM, the robot computes the shortest path to fetch items listed by a customer in a shopping list. The slides below include a video of the first tests. They also give a bird’s eye view of the architecture, where we use Pharo for orchestration. We also reuse existing software from the ROS community through our client PhaROS.


My objective is to have:

  • A virtual image: VirtualBox (preferred), VMWare
  • with Ubuntu: precise? 12.04 (preferred because LTS), quantal 12.10, raring 13.04
  • ROS: Groovy (preferred because latest stable), Hydro (but still unstable), Fuerte (no because no Catkin)
  • MORSE simulator: 1.0 (latest stable), newer

If you don’t want to install it yourself, you can download my VMWare 4.1.4 image of a ROS Groovy on an Ubuntu Quantal 12.10 with MORSE (updated 2013-05-13).

If it works on a newer version of VMWare, please let me know.

Constraints & Incompatible Combinations

I learnt the hard way the multiple incompatible combinations ;-)
Here some constraints:

  • Ubuntu and ROS. You can find here a really good help. So, Groovy works on 12.04 and Quantal (12.10) but not Raring (13.04) which can be used with Hydro.
  • VirtualBox and Ubuntu. The following report on using the latest VirtualBox on OSX 4.2.x :
    • Ubuntu 12.04: no problem but Groovy cannot be installed on top of it.
    • Ubuntu 12.10: it is really slow. It seems to be 3D support problem but I did not succeed to fix it.
    • Ubuntu 13.04: it works perfectly after installing VBox tools and 3D acceleration (cf. here) but Groovy cannot be installed on top of it.
  • ROS and MORSE. MORSE requires Python>=3 but ROS is currently Python 2.7 compliant, even Hydro. However, the MORSE installations notes describes a solution to make install.

Finally I went for:

  • VMWare 4.1.4
  • Ubuntu 12.10
  • ROS Groovy
  • MORSE bleeeding edge

Step 1: Ubuntu Quantal (12.10) on VMWare 4.1.4

It has been straightforward. Steps:

  1. Download Ubuntu iso (ubuntu-12.10-desktop-i386.iso)
  2. Create a VM image in VMWare
  3. Boot on Iso mounted in CD
  4. Install
  5. VMWare Tools should install automatically
  6. Ensure that 3D acceleration checkbox is cheked in the VM preferences
  7. Ensure 3D acceleration is working well by doing in command line:

    /usr/lib/nux/unity_support_test -p

  8. I advise you to do a VM snapshot here ;-)

Step 2: ROS Groovy Installation

Documentation is here.

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu quantal 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
sudo apt-get install ros-groovy-desktop-full
sudo rosdep init
rosdep update
echo "source /opt/ros/groovy/setup.bash" >> ~/.bashrc
source ~/.bashrc

Test that ROS is working

TODO: Je ne suis plus sûr de cette ligne ;-)
roscheck ?

You can also do the ROS tutorials.

Step 3: MORSE Installation

Documentation is here.
But we must make ROS Python 3 compliant first.

ROS and Python 3

Documentation is here.

Doing sudo apt-get install morse-simulator did not work for me because of Python problems.

Manual installation steps:

  1. Re-install ROS catkin_pkg from sources to make it use Python 3.
  2. git clone git://github.com/ros-infrastructure/catkin_pkg.git -b 0.1.9
    cd catkin_pkg
    sudo python3 setup.py install
    
  3. Re-install ROS catkin from sources to make it use Python 3. However, cloning the regular catkin repository on github did not work for me because of syntax changes in Python 3 (u"xxx" not supported anymore). So I use here my cloned and modified version. However, I advise you to first check if it has been corrected in the official repository.
  4. # slightly modified version of catkin to support Python 3
    git clone git://github.com/LucFabresse/catkin.git
    cd catkin
    sudo python3 setup.py install
    

MORSE real Installation

sudo apt-get install python3-dev
cd ~
git clone https://github.com/laas/morse.git
cd morse

# if you want a stable version, just checkout the right branch or skip the next command
git checkout -b 1.0_STABLE -t origin/1.0_STABLE

mkdir build && cd build

# compile with the support you need. have a look at cmake --help.
cmake -DPYMORSE_SUPPORT=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_ROS_SUPPORT=ON -DPYTHON_EXECUTABLE=`which python3` ..

sudo make install

You can now test that MORSE is working by executing:

morse check

Step 4: Post-Install

Congrats, if you reached this step, everything is done and you can work.

But I advise you to do a VM snapshot or better a VM clone ;-)

How to Update the Installation

For Ubuntu and ROS:

apt-get update
apt-get upgrade

Be careful, it may install a non Python3-compliant ROS version!

cd ~/morse
git pull
cd build
sudo make install

Use it remotely

You can even use it remotely through ssh -X

Conclusion

That’s all folks.
I hope it saved some time for someone out there.