Let's Make Robots!

Live soccer robots on LMR

Recently Gareth suggested to me that it would be good to have 2 teams of my bi-ped robots playing soccer. This was too good an idea to ignore.

After talking about this idea backstage this is where we are at:

On behalf of DAGU I will donate 6 Mini-Biped robots (plus spare parts) and an Arduino compatible IR transmitter to control them. Frits has volunteered to host the robot soccer match. Players would control the robots from their homes via the internet and the video would be streamed on LMR so the players can see what their robot is doing.

What we need is someone who can write some simple software to be loaded on the player and host computers.
The software for the the players will take keyboard commands (e.g. Cursor keys and spacebar) and send this information via the Internet to the host PC.
The software for the host computer (preferably mac compatible) will receive the data from the 6 player computers and send it to the Arduino compatible transmitter as serial data.
The data only needs to be a simple code such as the number 1-6 indicating which player has pressed a key followed by a letter A-E indicating which key was pressed.
A = forward       
B = backward
C = left
D = right
E = stop / kick
Thus the data stream would be something like 0D1A2A3E4D5C etc.
These robots are small, slow and clumsy so while the game will not be fast and furious I hope it will be fun to watch as well as to play.



Below is an explanation of how I will be programming the Arduino transmitter which will receive serial data from the host computer the same as it would using the serial monitor built into the Arduino enviroment. The Host computer will simply pass on the data it receives from the players computers.

Because the IR receiver needs to receive at least 14 pulses at 38KHz to recognise a 1, the Sony protocol uses 600uS as the width of a data bit and 1200uS as the width of the start bit. These times could be shortened but that could reduce reliability so for now I will stick with them. Beyond that I am ditching the Sony protocol which has 7 data bits and 5 device bits for a shorter, faster protocol.

I will write the Arduino code to send out 1 start bit, 3 player ID bits and 3 command bits. This will allow a maximum of 8 player and 8 commands. For now we will only have 6 players and 5 commands.

The Arduino will poll the player IDs thus the first 3 ID bits will count 0-5 repeatedly. The command sent out will be the last command received for that robot.

Each robot will be programmed with it's own ID so for example when the code 1A is sent out, all robots will receive the code but only robot 1 will respond and walk forward.

Because the slow IR transmission presents a bottle neck to the flow of data it would probably be best if the program running on the players computers limited the rate it sent command to 10 commands per seccond. This is fast enough to ensure a reasonable response time but will prevent the Arduino serial buffer from overflowing.

7 lovely red robot brains sitting on my desk. The main PCB is a simple little Arduino compatible board. The smaller PCB at the back is his "backpack" with speaker and IR comms hardware. An IR compound eye plugs into the front. I should have 7 little robots on their way to Frit's house next week. The seventh is a spare, just in case.

I've dubbed them the 7 dwarfs.
Here are some links to video of the prototype so you can get an idea what their soccer skill are like :P

RC chasing a ball: http://v.youku.com/v_show/id_XMTg0NDMxNTY4.html

Autonomous goal keeper: http://v.youku.com/v_show/id_XMTk5NDY1MTcy.html

Update: 20-09-2010

I have upgraded the Game Transmitter hardware and software to allow the pan/tilt assemblies to fire lasers (or other weapons) at the players. Lets be honest, no robot competition is complete without laser fire!

I have attached the code for both the game transmitter and the soccerbots. Currently the soccerbots will accept commands from both the game transmitter and a TV remote. The TV remote allows the host (Frits) to calibrate and test the players without a computer. The players ID can also be entered by TV remote so that if a player dies during a match Frits can quicky replace it with the spare robot just by changing the spare robots player ID to that of the dead robot.

Calibration settings and player ID are stored in the robots EEPROM so that the data isn't lost when the robot is turned off.

Update: 22-09-2010

As the famous saying goes, the devil is in the details! The seven dwarfs are not accepting commands from the game transmitter. As they work fine from the TV remote I have to assume the problem is with the transmitter. On the oscilloscope the transmitter seems to work fine with a nice modulated 38KHz signal.

Until I can sort this problem out the Dwarfs are staying in China :(



Update: 22-01-2011

Well they are finally in Frits's workshop. If nothing else Frits will learn a bit about Arduino. I did a lot of last minute stuff before I sent it all out and forgot the ball in the process. Now I need to get some instructions together for Frits.

I've taken some of Frits's photos and labelled them so every one knows what all the thingys are.

The Mini-Bipeds are normally sold pre-programmed for use by younger robot enthusiest. Therefore a programming cable was not produced. As Frits's will probably need to update the code a few times I quickly made up a cable. Experienced users can make a serial cable quite easily or use the ISP socket.


Soccerbot_transmitter_V2.zip2.35 KB
Soccerbot_V1.zip3.7 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Thanks nuumio ! 

HEY your pressing the buttons !?!?   I didn't say the buttons worked !  (kidding)

Yes there are few exception, here's why :
1. The GUI tries to build GUIs for all Services it has in config.  "match01" for the SoccerGame I loaded manually and it does not have enough info to build that GUI - I did this so your applet knows where to go, even though I don't want it to load the SoccerGame (Player's in charge of the game, oh no!) ... So boom an exception - cept its caught - but I'll think about cleaning that up.

2. Yeah no file io in applets - its pretty constrained. That's a convenient debug button for me, no harm no foul.

3. The freezing might be a couple things - the JVM doing cleanup & shutting down, or something I'll have to check, which is when the applet unloads weather the Services shut down cleanly - it's a multi-threaded app & the gui is just a couple threads.. may have forgotten some resource releasing..

Heh, I also noticed you have 2 X GUI's - this is from reloading the applet - apparently some parts of an applet are shared - I'll look into making this a Singleton.

Oh, and the socket error was cause the host was not running at the time you tried to connect - I think it should be more pretty though and actually report to the gui something ... like - "Soccer Game @ UTC 2010 09 22 - come back then !"

No problem. I was kinda expecting exceptions. I know what it's like when you are writing new code like mad and at the same time people are testing your stuff.

That freezing is something weird though. I have seen Java apps freeze when the garbage collector hits buts this thing freezes the whole computer, well user interface at least. Even mouse cursor stops. This might of course have something to do with the VM on Windows. I don't recall seeing this on Linux (I can check this later).



Tried on Kubuntu Linux 10.4 running in Virtualbox (Vista as host). Loads and runs fine on Firefox and Konqueror. Tech info:
$ uname -a
Linux kcm 2.6.32-24-generic #42-Ubuntu SMP Fri Aug 20 14:24:04 UTC 2010 i686 GNU/Linux

Java VM version: 1.6.0_20
Java VM vendor:  Sun Microsystems Inc.
Java VM: Sun Microsystems Inc. 1.6.0_20

Got those same exceptions too.


Looking good!

The laser idea isn't such a bad idea either. If you could aim a laser at a players IR receiver it would probably register well enough to effectively blind that player. Like you see in the movies where they reflect sunlight from their watch into a players eyes :D

A typical "Near IR" phototransistor has a relative sensitivity of ~60% to red light like you'd get from a common cheap red diode laser. Even at <1mW output power a direct hit would surely swamp the sensor and block incoming commands =D

I still get "loading java applet failed"

I am on OSX 1.5, and have tried java se 6 64 bit, J2SE 5 64 bit and J2SE 5 32 bit.

A couple of possible solutions ?:

1. If your using Safari - try a different Browser Firefox perhaps?
2. Open the Java Console - http://thedesignspace.net/MT2archives/000201.html  It should tell you what version you are running - mine has a logging section which has proven helpful in debugging.  
3. Also understand - some confusion can happen between the version of the Java Plugin (for a browser) vs Java on the machine - just something to be aware of.

Let me know.


They look much more advanced than our team !

But with a little swarm technology we could over-run them !!!!

Quick OddBot we need about 100 more !!!

Hey, but they dont play in my house!

This is after the championship at your house...
Of course, you'll have to shlep all 107 to Japan