Monday, August 22, 2011

More robot soccer!

Some rather good action in a humanoid robot soccer game:


The non-humanoid robots are much better players than humanoid machines:


OpenCV and a webcam stream: a fail and a win

I managed to compile OpenCV with FFmpeg support for the Chumby. Unfortunately this did not solve my problem, because FFmpeg is not able to decode the MJPEG stream from my web camera via mjpg_streamer. I've found an another solution that works, though! More on that in the end of this post.

OpenCV with FFmpeg does work with video files (I tested with an AVI DIVX file) and might work with the stream generated by some other web camera, so I'm including some notes on how to repeat the build procedure:

  • I got the latest FFmpeg source code using git clone git://git.videolan.org/ffmpeg.git. This was perhaps a mistake, because it turned out that compatibility with OpenCV 2.2.0 had been broken at some point. Fortunately I found patches that fixed this issue in the OpenCV source code.
  • FFmpeg had to be configured with the --enable-shared option. I used the command 
~/chumby-sw/OpenCV-2.2.0/release$ sb2 ./configure --prefix=/home/<my-username>/chumby-buildroot/usr --enable-shared
  • I had to apply another patch to OpenCV-2.2.0 source code to fix some linker errors (../../lib/libopencv_features2d.so.2.2.0: undefined reference to `cv::SIFT::SIFT(double, bool, bool, int, int, int, int)' etc.)
  • I used the following commands to configure and build OpenCV:
~/chumby-sw/OpenCV-2.2.0/release$ sb2 cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/<my-username>/chumby-buildroot/usr -D BUILD_PYTHON_SUPPORT=OFF -D BUILD_NEW_PYTHON_SUPPORT=OFF .. 
~/chumby-sw/OpenCV-2.2.0/release$ sb2 make
The working solution I mentioned above is simply to decode the motion-JPEG stream generated by mjpg_streamer manually and use some functions from libjpeg together with OpenCV's cvCreateImageHeader and cvCreateData to convert the individual JPG images into OpenCV's IplImages. I found some sample code that I could easily modify to suit my purposes.

Working on getting things to work on the Chumby

Recently I've been working on a couple of things related to my robot project.

  1. Getting Chumby and Arduino to talk to each other via USB serial. I've successfully completed a simple test where the Chumby sends an ASCII message to the Arduino, and the Arduino then shows the message on its LCD and echoes it back to the Chumby. Still to be done: writing a proper communication protocol that will be used by SHORT-E.
  2. Trying to build and install a working version of the OpenCV computer vision library for the Chumby. It has not been easy. The current status is such that I managed to compile and install OpenCV, but for some reason it cannot load JPEG or PNG images even though I have built libjpeg and libpng for the Chumby and they work ok with other software (at least Fswebcam is able to use them). And even worse, OpenCV cannot seem to get proper frames directly from my webcam, even though it manages to trigger the camera to capture something.
I had to use OpenCV 2.2.0 because I couldn't configure the latest version not to support Python - and OpenCV's stupid CMake configuration scheme makes it next to impossible to cross-compile a version that does support Python. And I do have Python on my Chumby.

Currently I'm able to use OpenCV with BMP images, and I've found a piece of code that does JPEG to BMP conversion using libjpeg. I'm still hoping to get OpenCV to support my web camera by trying to compile a version of OpenCV that uses FFmpeg. First I'll of course have to build FFmpeg for the Chumby.

I'm hoping to be able to implement some sort of simple tracking functionality using OpenCV. E.g. have SHORT-E find and drive to a red ball or even follow a moving person. Hopefully Chumby's processing power will suffice for something like this.

Sunday, August 21, 2011

Finding a new robot platform

Although I haven't yet completed my first version of SHORT-E built on the Scooterbot two-wheel platform, I have already started pondering about what my next robot will be like. As I wrote in my earlier post, the Scooterbot cannot really move on anything else than hard floor. We do have wooden floors in our apartment, but there are also rugs and thresholds that pose a big problem for SHORT-E.

Although I won't probably be getting a new platform at least for a few months, I've listed my (currently known) requirements and started to sketch a list of alternatives.

Here are my requirements:


  • Tracked, four-wheeled, six-wheeled, or similar type that can move also on carpets and rugs, and overcome small thresholds and obstacles.
  • Preferably available as an off-the-shelf kit, with chassis, wheels, motors, etc.
  • Big enough to have room to mount a Chumby One in addition to batteries, an Arduino, web camera, sensors, etc.
  • Possibility to mount a gripper or a robot arm.
  • Preferably enough space inside the chassis for batteries, Arduino and a small breadboard or printed circuit board.
  • Shouldn't cost more than 500€, and the cheaper the better.


My current list of alternatives is pretty short:

  • Large enough, seems pretty rugged.
  • Enough room inside for batteries and electronics.
  • Good-sized surface to mount Chumby, camera, sensors, and gripper on. 
  • Includes two DC motors but no batteries or electronics.
  • Motors have integrated quadrature encoders, which is nice.
  • Price: 192.55€ 



Lynxmotion Aluminum 4WD1 Rover

  • Also large and rugged.
  • Some room inside, at least for batteries.
  • Specially designed add-ons and accessories available: gripper kit, extra decks, etc.
  • Includes four DC motors but no batteries or electronics.
  • Where to fit shaft encoders? The motors included do not seem to have rear shafts. Would perhaps have to buy different motors, which would add to the cost.
  • Price: 235.43€


  • Small, but might be just large enough with the optional expansion plate.
  • Comes complete with an Arduino Duemilanove. Although I already have one, it wouldn't hurt to have two (no need to butcher SHORT-E for parts).
  • Comes with the Tamiya Twin Motor Gearbox and a DC motor controller for the Arduino. No rotary encoders, but I could probably install my CNY70 based ones. I found a good article on how to modify this gearbox for adding encoders.
  • According to the user guide, Lynxmotion Little Grip should fit. Weight would have to be added to the rear, but this wouldn't be a problem - I have to put the Chumby somewhere. I'm more worried whether the robot would be powerful enough to carry everything.
  • Perhaps too small for everything I want to install?
  • Cheap, price is 89.99€

At the moment the Traxster II is the top contestant, although I do like the specially designed accessories available for the Lynxmotion 4WD1, and the low price of the DFRobotShop Rover plus the fact that it comes with an Arduino and a motor controller.

I would really appreciate comments or advice from other robot builders. I just started this blog a couple of days ago and I know the number of readers is still small (haven't even been properly indexed by Google yet), but maybe there's already someone out there.

Saturday, August 20, 2011

Chumby comes to the house

As I wrote in my earlier post about choosing a robot brain, the Chumby One looks like a perfect Linux-based hacking platform for recreational roboticists on a budget. It has a 454MHz ARM processor, a 3.5" touch screen, audio, WiFi, USB, and it can be powered by an optional Li-ion battery. And, most importanty, it's cheap.

So I bought one.

I haven't connected the Chumby to SHORT-E yet, but I've installed and configured a Scratchbox 2 cross-compilation envinroment for the Chumby in Ubuntu 11.04. I used these instructions. In addition I had to install the realpath command using apt-get.

A word of warning: First I tried to install and configure Scratchbox using these instructions  in the Chumby Wiki. They didn't work at all for me. I had my doubts from the very beginning, as the instructions looked far too complicated. I don't recommend them.

 I have successfully compiled and installed several programs I will use in my project. These include fswebcam for capturing images from a webcam connected to the Chumby (I have successfully used a Logitech C-210) and mjpg-streamer for streaming video from the same webcam (see instructions in this Chumbysphere forum thread). I also compiled and installed the eSpeak speech synthesizer - see demo video below.



The face widget used in the video is just an app I found on chumby.com.

Friday, August 19, 2011

Free as a bird

Even the most advanced humanoid robots like Asimo look pretty awkward on the move, which makes it all the more astonishing how naturally and gracefully the Festo SmartBird flies:



Perhaps also recreational roboticists should get more interested in robots whose movement mechanics are inspired by animals. Judging by how well the SmartBird is doing, birds must be a lot easier to mimick than humans.

Humanoid robot soccer!

A couple of days ago my son and I watched some humanoid robot soccer videos on Youtube. He thought they were hilarious, and I'm inclined to agree. Here are a couple of them:



One of my dreams is to someday build a humanoid robot. These soccer videos show that although there are many fundamental challenges left to solve properly, at least these machines are able to play the game, even though they couldn't probably beat a kid that has just learned to walk.

I'm pretty sure Asimo would single-handedly crush any of the participating teams in these contests. Honda has spent a hefty sum of money on developing it, they are completely in a different league compared to the university research groups that participate in RoboCup. In the video below Asimo kicks a football and shows other tricks as well.