Soccer Robots
I’ve been a fan of robots for some time now and I have a bit of experience with this from college. Back in the day I was the team leader for Oklahoma State University’s first MiroSot Robot Soccer team.
A camera was mounted over the soccer board shown above and the robots were wirelessly controlled by a PC. One of the fun things possible with robots is using a simple algorithm to create complicated behavior.
To understand the algorithms we used, it would be useful to understand what we had to work with:
- The orange soccer ball would be detected by the camera and we would get X,Y coordinates
- The Soccer Robot would have an X,Y coordinate and a heading telling us which way it was pointing
Algorithm 1 – Mad Ball!
The first algorithm I wrote was very basic.
- Find the position of the ball and the Robot
- If the Robot isn’t facing the ball, turn the robot towards the ball
- Move towards the ball at maximum speed
There wasn’t any consideration of goals or strategy here. It was just a wild assault on the ball by every robot in sight and it looked a lot like little league soccer with a horde of kids in the center of the field trying to outkick each other.
As simple as this algorithm was, it worked pretty well for making goals. Granted, sometimes we scored against ourselves, but nobody is perfect.
Algorithm 2 – Goal Fever!
The second algorithm I wrote was an minor adjustment of the first algorithm.
- Find the position of the ball and the Robot
- Plot an imaginary kicking line from the center of the enemy goal through the ball
- Determine if the Robot is on the line with the ball between us an the enemy goal
- If he isn’t on the line, travel to it by the shortest route possible
- If he is on the line, turn and strike the ball into the enemy goal
This algorithm was good enough that when we played one-on-one against a robot controlled remotely by a human, we consistently beat them.
What else?
Maybe a Goalie?
If you have the Y coordinate of the ball, it wouldn’t be hard to make a goalie robot that didn’t do anything but try to match the Y position of the ball by moving back and forth in a line. Executed fast enough, the robot should be able to intercept the ball.
More Sophisticated Robots and Algorithms
We got a working system, but other colleges with experienced legacy teams have gotten into team play with passing and defenders. You will find some pretty intense videos on YouTube showing the traditional 2-wheeled robots as well as humanoid walkers and robots that are at least partially autonomous with their own vision systems.
NaroSot Robot Soccer Teams in Action
The point of this discussion is that with very little code you can produce sophisticated behavioral results. If your robot’s CPU is fast enough a simple rule or two may be sufficient to produce pretty good behavior. At the very least you can trash the other lab geeks in a friendly game of soccer.




