Here is the code that I used to put this all together. Note: IPs and port numbers have been obfuscated. If anyone sees a problem with the code or has a better solution let me know at bolo@bolobot.com. Everything here, of course, is open source. So to paraphrase the motto of the Sirius Cybernetics Corporation: Share and Enjoy.

Bolobot Code

One problem I had is that I needed a basic port redirector to be able to bridge the wireless network and the network where the server is. I tried many redirectors that I found on the net but none worked the way I wanted them to, so, I wrote my own:

redir.c

I use this to send the cam stream to the server and to send the cam streams to the gateway. The sniff option is also useful for decoding and debugging.

Then, to send the servo commands to the robot, I needed to write a server program:

bolosrv.c

This interprets a stream of numbers coming from the server and sends the appropriate command to the appropriate servo. I had originally planned to use cgi to send the commands to the robot, but this is a much better solution.

This uses the mini_ssc library written by James R. Bruce, which proved very useful. I got this from the servoserialdriver page of the www.wearcam.org website which has a lot of neat stuff.

Just for fun and debugging, I also wrote a litte curses-based program to use the arrow keys and numpad to move the camera and tread servos on the robot tank.c.

The server camera itself processes the commands directly from the input stream using a modified version of the very useful proccgi.c program that processes the cgi input. The servo.cgi program validates the input and sends it to the servo.c program, which is what sends the commands to the servos.

TO DO: When I get around to it, I'll combine servo.cgi and servo.c into one C program.

What about the leds? The leds check the status of the network in real time and choose which color led to display, that's done by led.cgi which does the checking using netcat and then cats the appropriate image.

The video streams are provided by camserv and the java stream viewer needed for explorer users is cservapplet. I played around with ffmpeg which also works and can be used to send different protocol streams, but, since it buffers through a file, there is a 20 second delay which isn't handy for doing what I'm doing which relies on a video stream that's truly live. I'm still playing around with this.

Unrelated Fun and Maybe Useful Code

These are some programs that I've written over the years that I seem to always end up going back to, they may or may not be useful:

bcnt.c counts the number of left and right parentheses and outputs the line number of mismatches.

putchar.c outputs the character or range of characters displayed by putchar.

count.c outputs an integer in a range in forward or reverse with a definable step. I think this was the first C program I ever wrote - I know linux has seq which does the same thing but HPUX doesn't have this fundamental program... and I wrote this when I was working on HP machines.

curs.c test if curses.

dice.c displays dice or a die.

fndctl.c finds control characters in a file or stream. The debug option is useful for finding the codes out of documents.

getip.c displays the ip of host.

hcln.c strips html tags. Very useful... I've used this with wget to get info on the command line from web pages - like for stock quotes.

prime.c Outputs prime number.

Guides and Whatnot

I wrote a beginners guide to vi to help people at work:

vi.txt And a beginners guide to shell:

shell.txt

I've also through the years collected my own personal tips and tricks files:

funwithawk

funwithcase

funwithed

funwithhtml

funwithlinux

funwithrecurs

funwithsed

funwithshell

funwithsysadm