Followers

Recent Posts

Showing posts with label control. Show all posts
Showing posts with label control. Show all posts

Friday, May 7, 2010

Bayesian Classifier Answers the Question: "Is it art?"




The title is a joke, by the way. Although I would be interested to see what the results of such an exercise would be. "Statue of David... *beep*: ART!", "Justin Beiber's Music... *beep* NOT_ART!".

Almost as exciting as my 0-R Spam filter. Catches 100% of spam with a 97% accuracy rate! Oh mercy.

The reason that I mention Bayesian Classifiers is because I wanted to talk about machine learning. This is the other branch of artificial intelligence and what most people think of when the topic of Skynet is brought up.

Fear not though. Bayes rule, decision trees and rule based learning are actually pretty mild. They are simply statistical methods of attempting to classify data by using the results of previous observations. Mostly harmless.

However, today I'm going to talk about genetic algorithms.

A genetic algorithm is an abstract representation of a mathematical function. They can take many forms, such as a string of bits which might indicate the presence/absence of a set of inputs, or a literal mathematical function "y = cos(x) - 2*z". The range of variables which is represented by the function is called a genome.

This can get a bit hard to visualize, so I often just settle for imagining genomes as Taylor polynomials. Therefore, a single genome consists of "x = A*input1^a + B*input2^b ..." where the values of A and a can take any real number. If some of the inputs are simply a higher derivatives of other inputs, then any arbitrary function can be represented in this way. There is also a rather nice representation involving trees.

If we start off with a population of individuals with random valued variables in their genomes, then we can evaluate each function to see how well it 'fits' a set of training data. The individuals which produce the minimum mean squared error for the training data are declared the 'fittest', and are allowed to survive into the next generation.

This is where the 'genetic' part comes in. There are many ways of 'evolving', 'mutating' and 'breeding' individuals, but the easiest to understand is the asexual method. This means that all individuals except the best performer are killed off (ie, deleted) and then their places are taken by the offspring of the remaining individual. However, tiny random 'mutations' are introduced to each of the new individuals variables - such as doubling/halving the values of A or B, or incrementing/decrementing a or b.

Anyway, thats the 30 second version of genetic algorithms. They can be used to find a semi-optimal solution to many problems, provided you can throw enough generations at them. I have been working with a C++ implementation called GAlib. If you are interested, I highly recommend going through the examples.

Now, some of you may be wondering what all this has to do with robots (actually, most of you are probably already filling in the blanks and peeing your pants in terror).

I've spoken on several occasions about using Robobob as a platform to investigate dynamic balance and movement. I plan to represent the control state of the robot as a search tree, with the robot beginning at a starting node/state and attempting to plan a path of control actions to reach a goal node/state. To navigate the tree, I want to implement a greedy search heuristic which will choose which control actions are most likely to lead to the goal state.



Now here's the tricky part - I intend to implement the heuristic as an evolutionary algorithm which can then be rewarded or punished depending on the outcome of executing the control path on the real robot. ie, if the heuristic gets stuck or can't find the goal state, it will be disfavored whereas successfully reaching the goal will be favored. After a series of generations, I will be able to study the path planning method which has evolved from this process.

Cool? I hope so.

Terrifying? Definitely.




Tuesday, February 2, 2010

Robobob

Ladies and gentlemen, I give you: Robobob!



You may recall that awhile back I opened my inbox to email suggestions for a good name. I actually intended to draw the name randomly or put up a poll, but once I started calling him Robobob the name sort of just stuck.

So here he is, in all his 16DOF glory standing up to a withering barrage of socks from all directions.

Once again, he has no gyroscope or accelerometer - he is simply using kinematic feedback from his servos to keep himself stable. The algorithm is almost identical to the one I used way back in this post - but he can now withstand attacks from all directions.

You may notice that he always moves with the force that he is being subjected to. This is the same way that humans usually react - recoiling from a blow or a source of pain. I think it gives him a bit of a personality.

Sunday, January 10, 2010

A robot by any other name

I've been a bit serious recently, so lets have some fun.

First off, I've realised that my robot is more than a month old now, but still has no name! I'm not good with names, so I thought I'd open it up to the floor and see if anyone had any suggestions.

If possible, it should be a name which conveys his gentle nature, effervescent personality and love of outdoor sports.

Next, it's time for the cool robot of the week!



I've been talking about control theory quite a bit recently, and I've been doing some research into different methods which might be applicable to my dynamic balance problem. This video is of an inverted pendulum - the arm is free to rotate on the cart, and only the cart is free to move along the x-axis. The cart has a model of the system which it uses to swing the pendulum into a stable inverted state. This is a well studied area of control theory, and today's modern robots (and humans) have been doing this for awhile.

Not impressed? What about this:




Same problem, but with an extra degree of freedom. Now there is a compound pendulum (one pendulum free to rotate off the first pendulum), but still only the one cart. This is a non-holonomic system, which is much harder to control using conventional control methods.

Still not enough?





Here is the double pendulum problem again, but this time the cart has been replaced by an arm. Instead of being constrained to two dimensions, the control algorithm now has to cope with the non-linearity of moving the control arm in a 3D rotational space.

I know it's not the cute little humanoids you are used to, but from an engineering perspective this is significantly more impressive watching robots dancing.

Ok, maybe not.