pr2 and ros::gazebo simulator: workspace segmentation (table and tabletop objects)

Preliminary results for workspace extraction seems promising. Tests are done using various ros packages, particularly tabletop_object_detector and tabletop_collision_map_processing.

Table segmentation and object clustering can be done much better by fine-tuning the related parameters.

It is strange though, the cylinder model in gazebo seems to have problems with ray collisions. In some part of the video, cylinder is divided into two during clustering stage since rays directly pass through top of the cylinder.

The main loop seems to be really slow, but this is due to the 3d data acquisition rate, around 1-2 Hz. When the objects are moved, system reacts to the changes quickly, although the code hasn’t been optimized at all.

Swissranger sr4k model is put just across the robot for the time being, but it might be better, in terms of manipulation performance, putting the camera next to/top of the robot, or at least merging the sensori information obtained from the robots on-board 3d sensors. Yet, this is a temporary setup, and we don’t have that sort of sensors on our iCub robot, so I’m not going to deal with those issues.


Installing Ubuntu and ROS on the Gumstix Overo Fire

I found several resources on the web explaining how Ubuntu and ROS can be installed arm-based boards like Gumstix. Yet, I couldn’t get our  Gumstix Overo Fire fully ready for developing ROS applications by following any of them. Eventually, after hours of web-search, I got it working properly. I hope this post becomes useful for the ones having trouble with getting Ubuntu installed on Overos, configuring wifi properly, or installing ROS on armel Ubuntu filesystems.

1. Installing Ubuntu 10.04 Lucid on Gumstix Overo Fire COM

Ubuntu installation procedure is consisted of following steps:

  1. Creating a root file system for the desired Ubuntu distribution
  2. Partitioning and formatting a micro-sd card
  3. Installing the boot files
  4. Copying hardware-specific modules and firmware
  5. Configuring Ubuntu (users, wi-fi, packages etc.)

Please note that the following instructions are not necessarily run in this order, you can buy significant amount of time doing independent things concurrently (e.g. downloading the images, or binaries while partitioning the micro-sd). The whole procedure is supposed to take 1-2 hours depending on the speed of your internet connection and the way you follow the steps. But this order is roughly the quickest way to finish everything.

1.1 Creating a root file system for the desired Ubuntu distribution

Installing Ubuntu 10.04 on Gumstix Overo” guide covers pretty much everything for this step (This is also a very nice summary). Yet, there are tiny modifications which make life much easier for the upcoming steps (e.g. adding debian packages to the rootfs in the generation stage, not apt-getting them after everything is done since it is too slow to install things on the micro-sd cards).

sudo apt-get install rootstock qemu
sudo rootstock --serial ttyS2 -d lucid -f "gumstix" --seed lxde,gdm,openssh-server,x11vnc,wireless-tools,wpasupplicant

1.2 Partitioning and formatting a micro-sd card

Create a bootable microsd card” guide can be followed for this step.  The instructions are also listed below for your convenience:

sudo umount /dev/sde1
sudo fdisk /dev/sde
Command (m for help): o 
Command (m for help): p
Command (m for help): x
Expert command (m for help): h
Number of heads (1-256, default 4): 255
Expert command (m for help): s
Number of sectors (1-63, default 62): 63
Expert command (m for help): c
Number of cylinders (1-1048576, default 984): 247 
Expert command (m for help): r
Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
Partition number (1-4): 1
First cylinder (1-247, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-247, default 15): +32M 
Command (m for help): t
Hex code (type L to list codes): c 
Command (m for help): a
Partition number (1-4): 1 
Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
Partition number (1-4): 2
First cylinder (6-247, default 6): 6
Last cylinder or +size or +sizeM or +sizeK (6-247, default 247): 247
Command (m for help): w
sudo mkfs.vfat -F 32 /dev/sde1 -n FAT
sudo mkfs.ext3 /dev/sde2

1.3 Installing the boot files

Create a bootable microsd card” guide can be followed for this step too. You can obtain the necessary MLO, u-boot.bin and uImage.bin files for the Gumstix overo boards from the Sakoman website. I’ve installed the latest versions: MLO, u-boot, and uImage. I also downloaded the Sakoman’s latest console-image for overo to copy the hardware-specific modules and firmware to the rootfile system that is generated by using rootstock utility (explained later on).

Below, it is assumed that the card appears as a sde device and the partitions are sde1 and sde2. Besides, card directory is already created inside the /media directory to mount the partitions.

sudo mount /dev/sde1 /media/card 
sudo cp MLO-overo-201011150741 /media/card/MLO 
sudo cp u-boot-overo-201011150741.bin /media/card/u-boot.bin 
sudo cp uImage-overo-201011150741.bin /media/card/uImage 
sudo umount /dev/sde1 
sudo mount /dev/sde2 /media/card 
cd /media/card 
sudo tar xvzf where-rootfs-is-generated/armel-rootfs-????????.tgz

1.4 Copying hardware-specific modules and firmware

After untarring the omap3-console-image-overo-201011150741.tar.bz2 to a directory we should copy the modules and the firmware folders which include the wi-fi drivers -whereas the package that “Installing Ubuntu 10.04 on Gumstix Overo” guide directs doesn’t have wireless drivers-.

cd /media/card 
sudo cp -r /where-you-untarred-omap3-console-image/lib/firmware lib/ 
sudo cp -r /where-you-untarred/omap3-console-image/lib/modules lib/

1.5 Configuring Ubuntu (users, wi-fi, packages etc.)

1.5.1 User and login issues

Configure Ubuntu section of “Installing Ubuntu 10.04 on Gumstix Overo” guide can be followed to solve user and login issues.

sudo gedit /media/card/etc/shadow

Then after a successful login, add users and change the /etc/shadow file back to the original:

sudo adduser youruser 
sudo adduser youruser 
sudo vi /etc/shadow

1.5.2 Wi-fi configuration

Now, we need to get wi-fi up and running. After installing wireless-tools and wpa_supplicant at the rootfs generation stage, we should change a few files to make gumstix connect encrypted or other kinds of wireless network.

I followed the instructions given in Overo Wifi and this websites.

Append the followings to the root’s .bashrc file:

rm /var/run/wpa_supplicant/wlan0
ifdown wlan0
ifup wlan0

Create a script file including the command and make it executable:

ifdown wlan0

Add symbolic links to this script file in the restart and shutdown run levels (/etc/rc6.d and /etc/rc0.d respectively).

Then, enable auto-login for the root user by modifying the last line of the file /etc/init/tty1.conf with the following line:

exec /bin/login -f root < /dev/tty1 > /dev/tty1 2>&1

After rebooting the Overo, you will see that the wireless card automatically run at the startup, so you will not need the serial console any more to connect to the Overo, since you can ssh in.

Lastly, modify the content related to the wlan0 inside the /etc/network/interfaces file as follows:

allow-hotplug wlan0
iface wlan0 inet dhcp
pre-up wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf -B
down killall wpa_supplicant

Where wpa_supplicant.conf file includes the specific configurations of the wireless network that the Overo is supposed to be connected. For instance, in my case the security settings include WPA2-personal with the TKIP and AES algorithms. Corresponding settings would be as follows:

# try WPA RSN if you WPA2 fails
pairwise=CCMP TKIP

1.5.3 Installing updates

Add these lines to the /etc/apt/sources.list:

deb lucid-updates main
deb lucid-security main

Then get updates:

sudo apt-get update && sudo apt-get upgrade 

2. Installing ROS

Things are much easier as soon as Ubuntu is installed on the Gumstix and internet configurations are done successfully.

In order to install ROS, just follow the instructions given in the installing-ROS-from-source tutorial.

After ROS installation, you may want to do a “hello world” stuff. Simple publisher-subscriber tutorials (this and this) would do the trick.

To mention some runtime observations, half of the RAM (122 MB) is used while running simple publisher-subscriber nodes, and the CPU is in such a good shape for the time being.

Output of the top command.

One thing deserves to be mentioned, configuring the swap region. This might be necessary (although memory access and write times are not so bright in the micro-sd cards) since using Ubuntu, and ROS-based memory consuming applications would easily require more than 256MB RAM. To do this I followed the “How to enable Linux swapping” tutorial of Sakoman inc.

Here are the commands for your convenience: (do as a superuser)

dd if=/dev/zero of=/swapfile bs=1024 count=512k mkswap /swapfile swapon /swapfile swapon -s

To make swap permanent following line should be added to /etc/fstab file:

/swapfile       none    swap    sw      0       0

That’s it, now we have a ROS installed Gumstix Overo.