Live soccer robots on LMR - Software

arduinoSerial.pde (8803Bytes)

This post is to help Frits or anyone else get and deploy the necessary software for OddBot's "Live soccer robots on LMR".

Description 
The game will be a multi-player remote control internet soccer game. Complete with cameramen, laser towers and any other silly shenanigans we can think of.

Parts

 

I have been working on a software framework for robotics for a considerable time.  One of its goals is to allow the creation of complex systems with simple Service Blocks.  The Service Blocks have inputs and outputs which can be tied together to create more complex structures.

 

I only created 2 new Service Blocks for the game (so far).  They are SoccerGame and Player Services.

Host

The Host computer will be running the SoccerGame Service.  Each Service must have a unique name to identify it.  It does not matter what the name is, as long as it's unique.  For this implementation, I chose "match01" for the name of the SoccerGame Service.  You can see it in the bottom left of the diagram.  

The Host computer will be running the following Service Blocks :

SoccerGame - match01 - this controls who gets in, who controls which robot, what team they are on, distributes service descriptions, starts the game and ends the game
RemoteAdapter - remote - allows foreign (Players) the ability to connect
GUIService - gamegui - the display gui - you don't need one, but if you choose, it certainly helps with remote control & debugging
Player - cameraman00, player01, player02, player03, player04 - holds data on who is in control (rik ctc..), what team they are on, what they can do (e.g. cameraman vs player vs lazer tower) and remaps and routes keyboard command to the appropriate service
Arduino - arduino - talks to an Arduino microcontroller, corresponding "slave" software is running on the Arduino, which basically remaps I/O commands
Servo - pan, tilt - servos
Speech - announcer - wrapped version of an open source Text To Speech system -  FreeTTS 

gamegui.png

When a GUI is used with MyRobotLab, you get a display of services and message routes (it's a bit cluttered, but you can move and sort out the blocks in the view by moving them with the mouse.)

The arrows in the diagram represent static message routes.  In the diagram you can see "remote" will send a message to"match01" when a connection is broken.  When a connection breaks (i.e. a Player disconnects), the SoccerGame will throw out that robot player, so another person can login and start controlling it.  The Servos are attached to the arduino card.  When they are told to moveTo a location, they notify the arduino to servoWrite.  This could just as easily be done to a PICAXE if I had the code (heh).  And finally whenever a pin is read on the arduino - the gamegui willdisplay it.  

Messages don't need to follow static routes but can be dynamically sent.  In that case the black arrows will not be shown. Messages and message routes can stretch between Services in the same process, between different processes on the same machine, or different machines.  This is how communication is maintained between the Players and the Host.

The Arduino runs a slave program called arduinoSerial.pde which will be attached to this page.

The Players

The players/client software can run as a stand alone application or loaded as an Applet off a web page.  The current dependencies for running the player part is Java 1.6 which can be found here.  Java typically can be installed without too much trouble.  You can see what version your browser is running here.  The Java Console is sometimes helpful in diagnosing problems, and it can be found here.

When the client loads it should look like this.  It is probably a goofy size (workin on that), but you can resize it to any dimension by grabbing the lower right corner with the mouse.  

client2.png

If you look at the dynamically created Service map you will notice a "gui(some random number) & match01".  The random number is to preserve the unique name requirement.  Really the only Service the client has is the GUIService ,  the match01 service is just an entry so the client knows where to send its first request. 

Press the communication tab - leave everything, but put your lmr login in login.  I disabled security checking at the moment as we continue to test/develop the system.

client.png

Most likely you will get "not connected" since its not ready yet...

But at some point - it will contact the SoccerGame through the RemoteAdatper and ask for Services it can use.  The SoccerGame will send the appropriate services depending on the type of player that is attached.

client3.png

In this case a Player (camerama00) was sent to the gui, now cameraman00 can be controlled by the remote user rik.

player.png

We have done some "field" testing with junky Lazer Tower #1.  
A few additional blocks we might want to add to our system are :

AudioFIle - a service which plays a particular mp3 file - the playing of it can be triggered by any sensor event for example an IR sensor could trigger a "GGGGOOOOAAAALLLL !!!!" mp3.  Do the robots have IR sensors on their feet?  Maybe tie that to a random Ouch.mp3, or Waaa.mp3, or it_hurts.mp3?

Joystick - can be used but only as an application - Applets do not have access to the joystick

OpenCV - can be used - but I have to still figure out an issue in transporting video

Onward !

Java
Java 1.6 for Mac - http://download.cnet.com/Apple-Java-Update-OS-X/3000-2213_4-10842013.html
Java 1.6 for Everyone else - http://www.java.com/en/download/manual.jsp

The other parts - download - http://soccer.myrobotlab.com/html.zip - unzip the parts

 

put them in a web server's folder. What no web server? 

Here is a link to install Apache2 on a mac http://switch.richard5.net/isp-in-a-box-v2/installing-apache-on-mac-os-x/

Player.jar
if you want to run the player as an application without a web server you need all 3 jars in a directory and run this at the command line :

java -jar Player.jar

SoccerGame.jar

java -jar SoccerGame.jar

good luck :D

GOOOOAAALLL !!!!!