[<< | Prev | Index | Next | >>]

Tuesday, September 22, 2009

Simon Funk's AI Challenge #1: Ball Passing




(Full window animation)

Here's the challenge:

You get points for touching the ball
with the hand of the same color as the ball.

You lose points for touching anything else,
or for the ball touching anything else.

There is a small additional cost to the
torque you apply (so it's better to be relaxed).

Your AI has to play without your help.
However, it does NOT have to run in realtime.

Here is the environment: Invivo, Challenge 1, Version 2
Or use "svn checkout http://invivo.googlecode.com/svn/trunk/ invivo"
[Update: Click Here for the Latest]

It's in python, and you'll need to get
pygame and pybox2d installed to make it work.
(You'll also need python-ming if you
want to generate flash animations.)

However, the interface is very simple,
so you can implement in whatever language you like,
and communicate via files, network,
or linking directly to python.

I will likely provide a network interface eventually,
and the actual challenge will be run that way
(so you run the brain on your machine,
and I run the simulation on mine).

End-date and exact rules for the contest TBD.
Anyone can enter, and the winner gets... to say they won.

Email me if you plan to participate want an invite to the project's mailing list.

-Simon (simonfunk@gmail.com)


    Interface01 is the i/o interface to a three-jointed bot
    with one touch sensor and a global sound sensor.

    Any position variable is an (x, y) tuple of floats representing a location,
    which may be in world or local coordinates as specified.  All positions
    are in the same units.

    Position-related velocities are also (x, y) tuples.  Angular velocities are scalars.

    Measurements (such as angles) are taken at the end of the most recent time step.
    Events (such as sounds) are accumulated during the timestep (exact time is not available).

    Static/Configuration info:

       .position     = where the base of the robot is located in world coordinates.
       .numjoints    = 3  (order is base, elbow, hand)
       .cost         = score cost per second of (torque/torquemax)^2 (per each joint)
       .torquesmax[n] = maxium abs torque joint n can exert.

    Sensors:

       .angles[n] = current angle of joint n.
       .angvel[n] = current angular velocity of joint n.

       .handpos = position of the center of the hand relative to .position
       .touch   = list of (position in hand coords, magnitude, reward) for any touch sensations on the hand.

       .ballpos = position of the ball in world coordinates.
       .ballvel = velocity of the ball.
       .ballrot = angular velocity of the ball.
       .ballcol = "color" of ball, from -1 (prefers left) to 1 (prefers right)
       .sound   = list of (worldpos, magnitude, reward) for any sound events

    Controls:

       .torques[n] = current torque exerted by joint n.


Here is a sample controller (the one shown in the above animation). This is the ONLY file you should change:

    import math

    class Controller(object):

        """Test controller for Interface01.
        """
        def __init__(self, interfaces):
            """Interfaces is a pair of Interface01 objects."""

            self.bots = interfaces

        def update(self, time):

            self.foo(self.bots[0], time)
            self.foo(self.bots[1], time*1.234 + 10.)
            #self.bar(self.bots[1])

        def bar(self, bot):
            for i in range(3):
                bot.torques[i] = -bot.angles[i] * 3. - bot.angvel[i] * .01

        def foo(self, bot, time):

            bot.torques[0] = math.sin(time    ) * bot.torquesmax[0]
            bot.torques[1] = math.sin(time*1.7) * bot.torquesmax[1]
            bot.torques[2] = math.sin(time*2.3) * bot.torquesmax[2]




[<< | Prev | Index | Next | >>]


Simon Funk / simonfunk@gmail.com