Friday, March 16, 2012


I am fascinated by Asimov's Gedankenexperiment  in robot design.  With pen and paper, and a degree in biochemistry he mapped out interesting territory in the intersection of robotics and humans.

Every sci-fi buff who has been to a movie theatre has had the three laws of robotics drilled into them, whether by watching the charming flick Bicentennial Man  or  "I, Robot"  (or as I think of it, I, Robot, the remix), we know, par coeur.

The Three Law, apart from being well founded, a good idea etc, provide a brilliant dramatic device for Asimov. His robots must follow the three laws, which seem reasonable and good, but when actually applied lead to some tense situation.

Over the last day or so, I have begun to re-read I,Robot. Each time I read it I know more about robotics and each time I read it,  I get the chilling feeling that Asimov was some kind of visitor from the future. How could he have figured out so much about robots without ever having built one?

I, Robot, chapter 1: Robbie

The story opens with a little 8 y.o. girl playing hid and go seek with her robot companion. The child is "it" first. She counts to 100 (in my day it was 10, I guess kids were more patient in those day.. !) . The child looks about, and leaves the magic zone of being between robbie and the home tree. Robbie sprints at high speed. Of course, the robot being of superior speed could easily outrun the child to"home base" but,  in the last 10 steps it slows down and lets the child win.

 From Principles of robot motion, H. Choset et al.. 
From an algorithmic point of view, this feels like Robbie is using a kind of potential field method to trigger his action to run. The Potential Field method, is a motion planning method were objects are represented as repelling objects, and the goal, the home tree in this case, is an attractor. Each object creates a Vector Field.

One way of thinking about of vector field is to stand outside your house with an arrow pointing from the center of your chest. Point the arrow towards your front door. Now  have a friend stand near you, say 20 paces away in some direction. Have her use and arrow in the same way.  Now image hundreds of friends with such arrows pointing toward home. That is a vector field. The robot needs only follow the arrows to get home.

One way of constructing a vector field is to start with a function of two variables, say x, and y representing the a grid stretched across a local path of earth, and let the center be the goal location in the case of a the vector field associated with the goal and taking the gradient of the function, and putting a minus sign in front of it.


Well, think of a really big bowl, centered at the home location, now if you were standing inside the bowl, the gradient would be the direction you would want to head to get out of the bowl, while the opposite of that (the negative) would lead you to the bottom of the bowl.  If all of our friends are standing in the bowl with arrows pointing to the bottom of the bowl, then, you get the idea.

[This is not the only way of creating a vector field and in fact many really useful vector field can exist with are not simple .]

Ok, now the problem with such methods is simply, what function should you start with to give you a vector field.

If we start with a cone  the gradient is of constant magnitude (and hence the robot will move at a constant speed). Now, that is not a good thing. If our friend robbie is running at top speed, he would not slow down, but would just smack into the tree.

Hmmm, what about parabola (beautiful example!).   Well, when the robot is far away, it would have a gradient approaching infinity. So, this is clearly not possible.  But as we got closer, the gradient of the parabola would gradually approach zero.

One idea is to use a cone for distances far away, say, more than ten feet, and then a parabola for distances closer. The effect would be that the robot would move at top speed to the obstacle, then, just before reaching the obstacle would begin to slow down quickly. Just as Asimov described in his book!

Of course, robbie may just have wanted to let the little girl win. Or, did he predict this now well known algorithm for robot path planning?

Dr -T

Thursday, March 15, 2012

Rasberry PI for PI day

The Raspberry Pi is causing quite a stir on the streets.  With a built in Graphics Processing unit... which I suspect can be used for video processing... this $25.00 board is capable of 24 GFLOPS.

Microchip has a nice product in the PIC32, but the performance pales in comparison. Futher, the PIC32 development systems cost far more and offer far less in speed performance.

I have not looked at the power per flop usage of the two, but, it is  clear that for serious robotics... trying to tap into vision, SLAM, and my favorite- Legged Robots- we need a little more ump than what the PIC32 currently offers.

More critically, the ARM architecture is what Cell phone are made from. It is what students in college want to learn about. However, traditional hands-on microprocessor courses focus on PICs, ATMEL processors with rather anemic processing power.

Student: "Heh Dr. Lewis, are you going to teach us how to build a cell phone?"
Dr. T: "er.. not in this class.. ah... no.."
But now, with this board, we have the guts of a system that could be expanded into a pretty usable almost phone like device. Especially if you go on a shopping spree at SparkFun and check out the cool bits and pieces they have.

While I am a huge fan of microchip, I am frustrated by the fact that it is difficult to run Linux on this processors. The Rasberry has a linux distro, and very importantly comes with nice programming languages. Languages like the language of choice for beginning roboticists: Python.

Python is a very elegant scripting language. (I can't believe I am saying this. On my first encounter with Python, I found it unbelievably frustrating and draconian in its indentation policy)
You type, and you get results instantly. What can be more rewarding! Its like being back in the old days of Lisp. Programming is actually fun and incredibly productive.

With such a huge about of code available.  I feel like Trinity in the Matrix in the famous Helicopter scene:

Neo:  "can you fly that thing? 
Trinity: "not yet, Tank, I need a pilot program for a B 212 helicopter. Hurry!"

Trinity's eye flutter, for a moment then

Trinity: "let's go"

That's pretty much my experience with using python.

Me thinking : "I need a elegant machine learning modules that is easy to use."

On my Mac it is as easy as :
port search learn
I get a bunch of results and then select one promising module:
port install py27-scikits-learn 
for my version of python and in minutes I have a naive Bayesian classier running.

Need code to do voice reco on my mac using google voice? Bam! Within 15 minutes world class speech reco is up and running.

Need vision, OpenCv has great python binding.... (Ok, there are a few tricks to building it so that it runs fast... but the standard mac port build is pretty darn good.

So, what does this have to do with the Rasberry?

Here is my vision of the future of Robotic Education:

Rasberry+Mobile Platform+ Camera+Python = Fast Fun and Effective learning.

If you want to dig deeper into the inner working of the platforms, feel free to tear it appart. No worries, its only $25.00!

Yes, yes, there have been Panda boards with ARMs, Beagle Boards, BeagleBone boards, but when you look at the cost of those platforms, it is out of reach for many state schools and high schools.

In my minds eye I see a $50.00 robot kit with awe inspiring processing power, Matrix like programmability doing real, hardcore robotics tasks.

IMHO, this board will take the world by storm.

-Dr T

Tuesday, March 6, 2012

Robots are cool to watch. They are technology in motion. Unlike a tablet or even an iPhone with siri, people anthropomorphize robots. In some cases, they project more intelligence into them than they have, and sometimes the intelligence is just not evident.

So robot videos very likely deceive the viewer. Robot guys like to know what is under the hood first before they see the video.

The public likes to see the video and very rarely cares about what is under the hood.

But it matters. At least to me.

What I mean is that people seem to have an appetite for robots and have an unfailing admiration for even the most minuscule advance in robotics. I often see videos of robots which the public finds interesting. I scratch my head in wonder and say, why do people find that cool?

Well, there are some clear rules as to what makes good research.

First, all research should a goal. These goals can be broadly defined along two dimensions: Applied Research or Basic Research.

Since this is a robotics blog, I willcontrive an example. Suppose you want to solve one of the two most important applied problems in robotics: "get me a beer" (the other having something to do with "lover robots" which are surely on the horizon).

You can approach this by a process commonly known as "hacking." You write a program, you tweak, you modify. You come up with a basic script which goes something like this:

Listen for a command.

Execute Command.

Under the execute command, you subdivide the problem into:

Command = Get a beer?

if yes, your robot executes this procedure (aka subroutine):

(1) go to the kitchen

(2) Open the fridge

(3) Find the beer

(4) Grab the beer

(5) Close the fridge

(6) Find you

(7) give you the beer.

So, that is a "hacked" solution.

It is a one-off, ad hoc (done for a specific purpose). If you sell this program to someone the process is commonly known in the robotics world as fobbing (I credit this colorful term to my friend Mark Tilden).

It is not general. Suppose you said: "bring me a class of merlot! " While to you and me these seem like related tasks, the robot would not be able to respond. It has no program to find the merlot, uncork it get a glass etc.

Regardless, we can play in this play ground of applied research for a long time and probably get a lot of papers, a paycheck and a girl or guy to have diner with on Saturday night... after cashing said paycheck.

We can ask such meaningful questions as: "How many times does the robot get the correct beer (and not a bottle of soy sauce)? "

How many times does it leave the door open.

How many types of refrigerators can we adapt to, etc.

All very practical questions of great concern to employers of roboticist. All of some commercial value. However, in my mind such solutions are, well, like one-line jokes. Fun the first time, but really old the second and third time.

I mean, would you rather be stuck in an elevator with Rodney Dangerfield (bless his soul) or Stephen Colbert? (if you don't know who I am talking about, google is your friend). Rodney has some incredible one-liners, but once you have heard them, the second time they are stale (lets give him credit and say the 3rd or forth time). Colbert, trained as improvisational comedian, could probably go on for hours without repeating himself.

So, back to robotics. If you want to be a robot scientist do you want to be a Rodney Dangerfield or a Stephen Colbert?

To build a robot like Colbert (asymmetric ears optional) you have to build something that can improvise sensibly in any situation. To do so, you need to have awareness and understanding of your surroundings.

So, we begin to think deeper. We begin about questions like:" What does it mean to "Understand" a command? " Why should the robot carry out a command in the first place. Can a robot have freewill (I would argue that any true robot can say, "nope, get it your self" or "Haven't you had enough already" Or "be careful you don't trip over your gut next time you go running" You know. The robot would have free will.

You might say: "What is a beer?" It is a kind of "object." "What is an object?"

Ah... you know it is a thingy... that I can pick up... Can you pick up all objects... no somethings are components like door knobs.. Are door knobs objects?

You get the idea. You begin to dig deeper into the meaning of things.

Finally, after about fifteen years, you emerge from your basement cellar, and you have thought very deep thought for a very long time (and didn't get tenure I may add) and have come up with fundamental answers.

What you realize is that to answer these questions you cannot reference just the physical world, you must reference the world of human perception. Of how the world is constructed by humans and you must understand human psychology well enough to match your robots view of the world with your own. Your say that your robot must share your "Merkwelt" (fancy german world for "world view). Using fancy foreign is really a good idea if you want to be published.

Wow.. Profound. Now we are getting somewhere. A robot that understands the world as you do. When you say "get me a beer" (and I am assuming the robot is in jovial and cooperative mood) it brings you the beer.

Both robots can perform the same task with the same input. Both look equally good on video. However, they are profoundly different in the approach they took to solve the problem.

Which one is better?

I cannot decide that answer for you. I can only say, that the "hack" is something one might do to whet one's appetite for robotic science but it is not robotics science itself.

While Steven Colbert might come up with a one-liner that floors you. His best one-liners (usually at the end of an interview with a guess) seem completely spontaneous, valid in just that moment and, therefore, genius.

Rodney Dangerfield may have a carefully crafted one liner. For my money, it would be a lot more fun to be trapped in an elevator with Colbert.

Anyway, I got a lot our of reading this book: Pasteur's Quadrant: Basic Science and Technological Innovation

I think it is a must for aspiring scientists of any sort.