Robot helps Kids with Autism

I came across this inspiring article on using robots to help kids with autism.

Two researchers with the Center for Health, Intervention, and Prevention (CHIP) at the University of Connecticut are exploring how to use robots to enhance the motor and social communication skills of children with Autism Spectrum Disorders (ASD). By programming the robot to talk and act in specific ways, they hope to come up with a new(?) and powerful method for teaching autistic children through role play and mimicry.

It’s a fabulous concept! Robots, who have infinite patience, will allow children to practice repeatedly at their own pace until they acquire the skill or learn a concept. Considering the intensive effort and high cost of providing treatment and educating kids with autism, robots can fill a much needed support role.

For their research project, Anjana Bhat and her co-investigator Timothy Gifford bought a 2-foot tall Nao robot from Aldebaran Robotics in France. What can it do? According to the article:

Nao introduces himself, extends his hand for a shake, announces that children like to play with him, and takes a bow. Nao even performs elaborate Tai Chi routines with accompanying music. But, most importantly for the researchers, the robot can be programmed to incrementally increase the complexity of its routines over time, as the children progress through therapy.

But with the Nao’s sticker price of about €10,000 (or roughly USD $12,800), it will likely find limited usage. I hope they make their robot program open-source so it can be ported to cheaper hardware. Perhaps we can now put all those Robosapien V2s dusting in a corner into real use.


Robosapien V2 Project Update

It’s been 3 months since I last posted. Life has conspired to keep be busy with other things including a job change (I now work at 510 Systems, a real-time 3D mobile mapping technology company in Berkeley, CA) and an awesome 3-week vacation trip to the Philippines. Now that things have settled down a bit, I can report some progress I made during the past several weeks.

For the most part, I worked on making my robot controllable by a computer through a standard serial (RS-232) port. I used an Arduino microcontroller to build the serial interface. I built the Arduino kit and wrote code to receive the computer commands and generate the raw serial pulses. More info on this Robosapien V2 project page.

Robosapien V2 is back in action

I finished repairing all broken wires on my Robosapien V2. First I considered completely replacing the two cable assemblies (ie, the wires with the plastic mating connectors) that snaked through each leg. However my email query to Wowwee tech support revealed that: (1) they don’t have replacement cables, and (2) they don’t know of other companies that sell them. In other words, if your robot breaks down you are on your own.

Fortunately I have the right tools to fix the problem. It took several hours of diligent soldering work which involved cutting each old wire, leaving just enough copper strand (approx 1/2 inch) jutting out of the plastic connector to allow splicing a new wire in. After soldering the spliced joint, I used heat shrink tubing to cover it. Ditto for all the other broken wires.

Here’s a short video of my Robosapien V2 making his moves again. Now, he’s ready for more serious hacking.

What I am working on…

Robosapien V2 standing

I’ve been busy the past three weeks with personal affairs but managed to tinker a bit with the Robosapien V2. Although he is a new addition (thanks, eBay!) to my small collection of hobby robots, the RS V2 is actually a relic from 2005, a discontinued 22-inch tall, walking robotic wonder that has been superceded by cutesy robo-critters that now litter Wowwee’s product line. Despite being obsolete, I still think the RS V2 could serve as a  versatile robot base for doing interesting experiments.

Before I can do the fun stuff, I must first grapple with the RS V2′s Archilles heel (no pun intended). You see, the Robosapien V2 is an engineering marvel– a sophisticated walking, talking, gesturing humanoid that achieves these complex behaviors using simple DC motors and inexpensive toy chips. Unfortunately, it was also plagued by problems from poor manufacturing. The wires that connect the motors and batteries to the electronic boards are shielded with cheap plastic insulation that frays and slowly falls apart as the wires bend and stretch when the robot moves. Eventually when enough insulation falls out, the bare wire strands inevitably touch together then POOF!!! … as plenty of irate Wowwee customers have complained.

Luckily, I saw the flaking wires in my RS V2 before any serious damage could happen and he is now under surgery.

Sample wires from the RS V2 showing how badly the insulation have fallen apart

These wires would not make the Fire marshalls happy.

Robosapien V2 under construction

RS V2 under the hood

I’m hoping to finish the rewiring this week. Stay tuned!

Peter Oravetz’s Robot Arts Gallery

OK, time for something fun and inspiring at the same time. I just found out about Peter Oravetz’s gallery of robot cartoons. Peter comments:

It’s always been entertaining for me to watch someone verbally and physically abuse a copy machine, a T.V., or any other electronic device. Obviously they don’t have feelings so there is no way they’ll ever yield to threats or sympathize with frustration. Moreover, they are made by us and can only do what we program them to do. Since humans aren’t perfect, robots will never be perfect either. We can program them to perform tasks perfectly but once a hurdle is presented unexpectedly, like a wall placed in their path, everything comes to a halt. This problem of how they can be so smart and yet so stupid is what interests me, as well as our efforts to empower them with Artificial Intelligence (or AI) so that they may figure out how to leap over these hurdles by themselves.

To me, the cartoons provide a profound insight on how robots of the future could ultimately engender human qualities. Here are my two favorites: (I added the titles, based on my interpretation of the art piece) I have been enlightened by Peter, the artiste himself, of the two pieces’ titles. Here they are again, this time with their original titles.

Folks, make sure to visit Peter’s online gallery. Or better yet, view his giant robot drawings in person at the North Bowl Lanes n Lounge if you are in Philadelphia. Thanks for commenting Peter, and best of luck with your exhibit!

Daddy robot laying on sofa after a long day's work, two kid robots rejuvenating him with oil.

"Prank" "After a Long Day's Work" Credit: Peter Oravetz Arts

Robot crouching on the ground studying and admiring a turle

"Turtle" "Admiring Nature". Credit: Peter Oravetz Arts

Microsoft picks PrimeSense 3-D sensor for Natal

Microsoft announced that it will use the PrimeSense 3D sensor for its Project Natal virtual gaming platform. According to Ilan Spillinger, vice president of Xbox 360 hardware at Microsoft, the PrimeSense sensor will be used to create an accessory for the XBox 360 that will allow users to interact with the gaming console using hand gestures and spoken commands.

This is the chip that I spoke about in my last blog, that allows for low-cost ranging camera to finally become a consumer product. Expect to see this cool gadget in time for the Christmas holidays later this year. I’ve been a good boy, Santa!  :-)   Credit to EETimes for this article.

RGB-D (Depth) Cameras for $100 in sight?

I love it when toys of the big boys finally become everyone’s.

According to Hizook’s blog, mass-affordable cameras that offer depth perception (aka RGB-D or “ranging” cameras) may finally hit the store shelves this year. This statement echoes what Dr. Deiter Fox of Intel Research Labs has proclaimed during his presentation last January at the 17th Annual Robotics Industry Forum. Specifically, Dr. Fox predicts that the new RGB-D cameras could retail for under $100 in 2010 along with other low-cost sensors, paving a path for affordable personal robots for the home.

To achieve this incredible cost-reduction, the upcoming RGB-D cameras will no doubt be based on custom chips such as the PrimeSensor SoC chip which is rumored to sell for $20-$30 in volume. Here is a block diagram of the PrimeSensor reference design.

System block diagram showing how the PrimeSensor is used

System block diagram showing how the PrimeSensor is used. Credit: PrimeSense Inc. (www.primesense.com)

I encourage you to visit Hizook’s blog and watch the cool vids. You’ll thank yourself for it.

Running the Numenta Software on Ubuntu 9.10 Linux

Recently, I have been experimenting with Numenta’s Vision Toolkit and NuPIC software. These two noteworthy products let developers, researchers and individuals alike create intelligent apps that can recognize objects or perform other complex tasks that involve learning, inference and prediction. Both tools are available from the Numenta website, albeit under a “play but don’t deploy” research license.

Windows and Mac OS X users can download the program, install and play right away. Life for Linux users is not as sweet, requiring some workarounds. Having done the install myself, I made this tutorial to help other Linux users get past the hurdles. I installed on Ubuntu 9.10 but you should be able to tweak these instructions for other Linux distros.

Installing the Vision Toolkit

  1. Install Wine (“Windows emulator”). I don’t exactly recall where I found the instruction… maybe in the Ubuntu Wine documentation page
  2. Download the Vision Toolkit program (requires login)
  3. Right click on the downloaded NumentaVisionToolkit-<version>.exe, select Open with Wine Windows Program Loader from the menu and follow the Windows setup.
  4. When the install completes, you should see an icon like the one below on your desktop. Double-click and prepare to conquer the world. :)

Numenta Vision Toolkit icon

Installing NuPIC

If you follow the NuPIC installation instructions for Linux on the Numenta website, you’ll find that it breaks with the latest Ubuntu (version 9.10 as of this writing). The problem is that the latest Ubuntu comes with Python 2.6 pre-installed. On the other hand, NuPIC 1.7.1 which was released last year is bundled with Python 2.5 packages. As a result, when you run the sample programs such as Bitworm (the “Hello World!” analogue of the HTM) you will be greeted with an error like this:

Error message in Step 7 of the NuPIC install guide for Linux

The last line reveals the culprit– NuPIC is looking for the shared Python library libpython2.5.so.1.0 which does not exist. There are at least two ways to fix this:

  • Use symbolic links to fool NuPIC into thinking that it is using Python 2.5 components (e.g., softlink libpython2.5.so.1.0 to the corresponding 2.6 shared library)
  • Make NuPIC work with Python 2.6

I did the latter because it looks like the cleaner solution. Besides I also use Python 2.6 packages such as numpy and matplotlib for other projects.

Let’s fix it!

1)  According to the install guide, we need a Python interpreter that supports 4-byte Unicode (aka “wide Unicode”) and shared libraries. Fortunately, the Python build that ships with Ubuntu 9.10 already comes with these features.

[Optional] If you’re curious to see if your Python interpreter really supports wide Unicode, see the note at the end of this article.

2)  Follow Steps 2 to 6 of the Numenta install guide, with one exception: in Step 5, set the PYTHONPATH to point to your python2.6 folder like this:

export PYTHONPATH=$NTA/lib/python2.6/site-packages:$PYTHONPATH

Don’t forget Step 6. (And yes, we’ll create a python2.6 folder next).

3.)  At this point, we diverge from the Numenta install guide. If you poke around, you will see that the tarball saved NuPIC’s required Python packages under $HOME/nta/current/lib/python2.5/site-packages. Instead of hackingpatching the existing obsolete files, we will clone the nupic folder and install the remaining packages directly from the Web. Here goes:

% cd $HOME/nta/nupic-1.7.1-linux32/lib
% mkdir python2.6
% mkdir python2.6/site-packages
% cp -pr python2.5/site-packages/nupic python2.6/site-packages

5)  Optional, but recommended.

% sudo apt-get update

6)  Install matplotlib and numpy packages

% sudo apt-get python-matplotlib

(NOTE: matplotlib is an powerful graphing and visualization tool (example below). Installing it also auto-installs other packages that NuPIC needs.)

7)  Install IPython as your interactive Python environment.

% sudo apt-get install python-setuptools
% sudo easy_install IPython

8. Next, verify that matplotlib and IPython installed properly.

% ipython -pylab

In the IPython shell, type these commands:

x = randn(10000)
hist(x, 100)

You should see a new window with a Bell curve like the following:

Bell curve graph output from IPython and matplotlib

Type quit() to quit.

8.) Finally, let’s run the BitWorld demo:

% cd $HOME/nta/current/share/projects/bitworm
% cd $HOME/nta/current/share/projects/bitworm
% python RunOnce.py

The output will be the file report.txt. However, all is not well. While the report.txt is correct and you can see the results in the file, the plotting is broken. I’ll work on this next time.
Plotting does not work yet.

PS - If you encounter problems and/or find a solution, please let me know.

Credits

Samiux’s Blog – installing IPython on Ubuntu
The matplotlib team – installing matplotlib


How to check if wide-Unicode support is enabled in Python

  1. Open a Terminal console by clicking Applications -> Accessories -> Terminal and call python:% python
  2. In the interpreter, enter this command:  unichr(2**17)

You should get the result:  u’\U00020000; if you get a ValueError instead, you don’t have wide Unicode support so recompile Python with this feature enabled.

Thoughts on OpenCV and the Numenta Vision Software

My game plan for building a vision system for my robot project has taken a sharp turn. Initially I had intended to use OpenCV’s object detection modules to build a classifier that can tell apart different kinds of common household objects: ball, doll, shoe, etc.– you know, things that a roaming bot would likely encounter. After sifting through numerous blog posts and tech papers online, I learned a few unsavory bits about Haartraining that prompted me to reconsider.

They are:

  1. Huge number of  training samples needed. Several individuals commented that you need hundreds to thousands of positive images per object category and a comparable number of negative examples to get decent results. Amassing this large collection of images is a daunting task and in my view, not scalable (practical).
  2. Long training time. Several sources have said it takes days to train the classifier on hundreds/thousands of images.
  3. Hard-to-train model. The OpenCV Haar-based classifier, a form of boosting algorithm, is composed of a chain of (typically ~20 to 25?) simpler classifiers working in concert. Each classifier makes the best decision it can while the next one in the chain tries to compensate for the mistakes of the previous, such that at the end of the chain, you get a highly filtered and accurate result.  The beauty of this approach is that, in effect, you get high recognition performance from a series of weaker parts.

So far, so good. But how do you as a designer tweak system’s behavior, besides adding ever more positive or negative images? Where are the levers of control? Hmm… Prompted by these concerns, I searched for a better mousetrap.

Enter Numenta

My search led me to Numenta which, as you may know, is Jeff Hawkin’s long-term venture to build a computing technology that mimics the brain (neocortex, to be more precise). I read his book “On Intelligence” some time ago and skimmed through documents on their early version of NuPIC platform. However at the time (circa 2008?), but I felt that it lacked the necessary support tools and user documentation to be readily used by an outsider.

Things have changed.

  • NuPIC v1.7.1, their toolkit that allows you to build your own computer “brain”, now comes with many examples, scripts and technical documentation to help you get started. The learning curve is still steep, Numenta itself admits, but made more palatable.
  • The Numenta Vision Toolkit is an easy to use GUI app for putting together an object recognition system. At first I was skeptical, but I cobbled an experiment (5 object categories, with ~50-200 training images per category) and was sufficiently convinced that: (1) training is fast… in minutes/hours, not days, (2) baseline accuracy is good. I was getting around 60-80% accuracy but mind you, I was using a some tough test images.

Here are a couple of results from my experiment. Note how the classifier recognized the spiky ornament and the ball of yarn as a “ball” (correct for my test, since they resemble a ball more than the other objects).

Correct recognition results from the Numenta Vision Toolkit: balls

An example of dolls misclassified as a “ball”. Anyone know why?

Incorrect recognition results from the Numenta Vision Toolkit: dolls as balls

Bottom line? Although it’s too early to tell, I like the initial results… enough to invest more time to explore the capabilities of the Numenta software.

Incidentally, the Vision Toolkit is officially supported only on Windows and Mac OS X. But I managed to successfully run it easily on Linux (Ubuntu 9.10). Here’s how:

  1. Install Wine (“Windows emulator”). I don’t exactly recall where I found the instruction… maybe in the Ubuntu Wine documentation page
  2. Then right click on the NumentaVisionToolkit-<version>.exe, select “Open with Wine Windows Program Loader” and follow the standard Windows instructions.
  3. When the install completes, you should see an icon on your desktop. Double-click and prepare to conquer the world.  :)

Instant on PC

Do you ever wonder why booting up a computer takes soo long? Why doesn’t it turn on instantly like a TV or DVD player? As it turns out, engineers at MontaVista Software thought the same thing, and have finally figured out how to tweak Linux to boot in under 1 second … yes, that’s “1″ as in “Done!”

Although they achieved this amazing feat on a specific embedded processor, MontaVista claims that the same techniques can be applied to standard Linux software. Here is a summary of their technique:

1.  Optimize the bootloader by omitting unneeded drivers, etc. (boot time now down to 7s)
2.  Use DMA to copy some boot code into the main memory cache, to execute tasks in parallel (now down to 4s)
3.  Do various tricks such as loading the customer’s app directly into the page cache (now down to 1s)

Simply amazing. I hope this idea catches on soon and gets folded into mainsteam OSes. In the meantime, I will stick with my usual routine. Turn on my computer, walk to the kitchen and brew coffee. By the time I’m back, my apps are happily waiting for me. On a good day, it feels like it’s instant on.  :-)