Humanoid Robot NAO performing Sun Salutation

I had the opportunity to implement the Human Robot Interaction module on the NAO Humanoid Robot during my internship at Gade Autonomous Systems Private Limited in Hyderabad recently. As a part of it, I programmed the NAO humanoid robot to perform the Surya Namaskar, the traditional Indian practice of Sun salutation. The video is a bit shaky in the start but gets better in a few seconds. Watch it here.

The development environment used was Choreographe by Aldebaran Robotics running on Ubuntu 11.10. Python was the primary programming language used. The behavior was simulated on NAOsim powered by Cogmation Robotics running remotely on a Windows 7 machine. The development of this behavior deliberately utilized all 3 methods that enable one to integrate motion into a behavior

  1. Using the Timeline Editor
  2. Using the Recording Mode
  3. Using the Motion API (ALMotion)

Each of these methods have their own ups and downs. For example programming in the actuator position values using the Motion API gives you unparalleled precision but at the same time it is time consuming. The timeline panel or the motion editor as it maybe called lets you define frames and animations or behaviors in those frames in a snap. In the recording mode, you can manually move NAO’s body to a specific pose and record the actuator position values.

The experience in building this behavior for NAO humanoid robot gave valuable learning as to how the simulator NAOsim tightly interfaced with the development suite Choreographe and Telepathe to allow for testing behaviors in a virtual world with real physics before playing it on NAO in the real world. Development, in particular, improved the understanding of synchronous and asynchronous flows while programming using the APIs as well as using the box-based GUI.

The inspiration for building this particular behavior came from observing the locals performing their religious practices while I stayed there and ideas from my dad and (the founder) Sasi Gade’s mom.

Me, teaching Surya Namaskar to NAO Humanoid Robot

Posted in Humanoid Robot | 1 Comment

pyblobs with OpenCV 2.1 on Ubuntu 11.10

pyblobs is a Python interface for cvBlobsLib. To use it with OpenCV 2.1 on Ubuntu 11.10 follow these steps.

Prerequisites

The following dependencies are required to use pyblobs library:

sudo apt-get install swig
sudo apt-get install libcv-dev
sudo apt-get install python2.7-dev
sudo apt-get install python-opencv

If you are using Python 2.6, then use sudo apt-get install python2.6-dev instead.

Getting the pyblobs library

Use svn to grab the source code

cd /path/to/Downloads/
svn checkout http://pyblobs.googlecode.com/svn/trunk/ pyblobs-read-only

Patching the files

The code from the trunk as of now uses Python 2.5 (python2.5-dev) and not the best way to link shared objects in the make_swig_shadow.sh file. There is another issue with building the pyblobs library to be used with OpenCV 2.1 in the file BlobExtraction.cpp

Hence, I have created two patch files for the aforementioned files:

Download these to the same directory as the downloaded library (pyblobs-read-only) and then run the following commands in the terminal:

cd /path/to/Downloads/pyblobs-read-only/
patch make_swig_shadow.sh make_swig_shadow.patch
patch BlobExtraction.cpp BlobExtraction.patch

If you are using Python 2.6, then after patching edit make_swig_shadow.sh and replace any occurennces of python2.7 with python2.6 .

Installation

To install

make
./make_swig_shadow.sh

To check your install, go to your Python shell and try the following imports:

>>> from blobs.BlobResult import CBlobResult
>>> from blobs.Blob import CBlob

If all goes well, you shouldn’t see any errors. Now you can work with pyblobs and OpenCV2.1 on Ubuntu 11.10!

That said, to get the example file demo.py working, you might need to modify it a little to use objects and methods from the newer OpenCV Python API. For example, in my programs I replace

from opencv import cv
from opencv import highgui

with import cv2.cv as cv to use the new API as cv.MethodName() instead of cv.cvMethodName() or highgui.cvMethodName(). Makes life a lot easier!

Posted in Computer Vision, Python | Tagged , , | Leave a comment