AI learns to balance a stick

Share with us how are you using the powerrrr of the force

Moderator: Alain

AI learns to balance a stick

Postby JoeWright » Fri May 06, 2005 8:34 am

I've written a programme using Newton, Irrlicht, genetic algorithms and neural networks to learn how to balance a stick.

Details and download at


Next is a bipedal walker hopefully
Posts: 69
Joined: Sat Apr 30, 2005 1:42 pm

Postby Xpoint » Fri May 06, 2005 8:45 am

nice job! :)
Very cool to see how the computer tries to balance the stick. :P
Hope to see that bipedal walker soon to! :D
User avatar
Posts: 71
Joined: Wed May 26, 2004 5:41 pm
Location: Netherlands

Postby JoeWright » Fri May 06, 2005 8:58 am


It gets there by about generation 10 for all those wondering how long they have to wait.
Posts: 69
Joined: Sat Apr 30, 2005 1:42 pm

Postby walaber » Sat May 07, 2005 12:21 am

very interesting work! you're biped idea sounds really cool (and challenging) as well.
Independent game developer of (mostly) physics-based games. Creator of "JellyCar" and lead designer of "Where's My Water?"
User avatar
Posts: 393
Joined: Wed Mar 17, 2004 3:40 am
Location: California, USA

Postby Julio Jerez » Sat May 07, 2005 5:07 am

Also to help with the AI sensor of the environment you could place some strategic larger collision ellipsoid with some special ID at the tip of the heels to act like radar or sensors. In the contact callback you reject the contacts that collision ID but save the position for later used in the joint callbacks.

These contacts positions and normals can be used in the joints controller by given the AI and idea of the terrain topology at the foot vicinity. It like a small radar or sensor with the difference that it is volumetric, and it will detect anything on the walker path in a very natural way (steps, rock, other bodies, etc), You can extend the idea to other parts of the body.

I am also very intrigue to see what you can come up with. I would not be very ambitious the first time maybe a gait, and then adding more parts as you go.

You do not know the power of the Newton side.
Julio Jerez
Posts: 11124
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Postby tim » Fri Jun 03, 2005 6:03 am

Hi Joe, very impressive demo. I have also tried something similar to this, but did not have much success. What sort of neural net are you utilizing, is it recurrent or a standard feed forward net. Also, what are the inputs to your neural net, are you utilizing the velocity at the tip, or the direction vectors of the stick. I would appreciate any help. cheers

Posts: 1
Joined: Tue Nov 23, 2004 4:22 am

Postby JoeWright » Fri Jun 03, 2005 7:34 am

I had four inputs to the NN:

1) Position of the hand (the sphere) in X axis
2) Velocity of hand in X axis
3) Position of stopper (sort of the tip but used stopper for convenience) in X axis
4) Velocity of stopper in X axis

The NN was a simple feed forward design.

One thing I must stress is that getting the physics model right is probably the most important thing.

For example, initially I had the stick too short which made it very unstable and didn't give the GA NN much of a chance.

So if you struggle on things like this, first look to the pysical model.

Posts: 69
Joined: Sat Apr 30, 2005 1:42 pm

Return to User Gallery

Who is online

Users browsing this forum: No registered users and 1 guest