Ustream-> Arduino. For My Chess Robot

irc.pl_.txt (2350Bytes)

Ok so the idea is to have live chess matches using Ustream and my chess robot on the front page of LMR. So i understand i need a IRC client and stuff. I have already made a bot and have it linked up to my Ustream. I need serial data from the commands that are typed into ustream from LMR members, like b8->b9, to go to my Arduino so the chess robot can move the piece. I have never written a computer program in my life and i dont know where to start or what to use. Please help so frits will stop bugging me. :)

Frits will never stop bugging you

Take it from a veteran.

I can only show you the code I used to interface an IRC channel with … erhm … I forgot. I think Darwinbot used several different programs to get code loaded up. The IRC “receiver” simply placed little files on disk.

My code was written in Perl.It does not use any fancy libraries, so the actual interpreting of IRC sentences lies bare in the main code. That could be very educational.

You say you never wrote a computer program. That also can be a good thing. Now you get to choose a language. This is the same kind of choice as the choice for a micro controller or language. Whatever suits you. Ask around for options. Who is willing to support you in your programming and your lessons.

I for one could only help you with Perl and maybe some Processing.org. And be willing to.

Tell Frits he’s a PITA. :wink:

I found this

I found this http://blog.datasingularity.com/?p=148, which exactly what i want to do. He is using Python. I am trying to figure out what programming language would be best for something like this so i can start learning it. Yes any advice on a programming language would be very helpful.

If Perl can do this, and you

If Perl can do this, and you know how to do this, then i might be better off with Perl. Im not sure the level of difficulty that this ranks.

The link will do it!

The link you posted has the code you will need I believe. I didn’t read to far into it, but from what I can see you can define functions that the python bot will read in IRC and will run Arduino functions based on it. 

In IRC, a user can say “arduino: funcution” which causes a function in the Arduino code to run. In your case you would let players send a message like “arduino: rook to A8.”, which would run a function that reads the current location of the players rook and moves it to A8. (I don’t play chess much, if A8 doesn’t exist, don’t make fun of me!)

Tinker with that code, it’ll work just as you need.

 

Well looks like i will be

Well looks like i will be going with Perl. Ran this fine http://oreilly.com/pub/h/1964. Getting all the messages from what is being typed into ustream, i just have to break them apart and stuff. 

remove the trailing dot

or the link won’t work

HTML is not as resilient as perl :wink:

I think this is the exact same code sample I started out with for Darwinbot. As soon as I find it again, I will post the result.

It’s Leisure Suite Larry all over again

Save all and save often.

Back to 2010: Save online!

https://www.robotshop.com/letsmakerobots/files/reception_bot.pl_.txt

Ok attached the script. Cant

Ok attached the script. Cant get the last if statement working. For some reason move is the last 6 characters of the message, maybe there is a \n in there?

oh yeah it works now. Should

oh yeah it works now. Should i do a tutorial ?

You bet!

You bet!

We should go online first!

We should go online first! Front page!

Ummm, Yes.

Uh yeah Pat,

I would love to see a walk through on this one.

It would be awesome. Good

It would be awesome. Good job on this one!

Is the live stream up yet?

Is the live stream up yet? Is the IRC channel public? Great job by the way.

IRC channels for ustream.tv

Patrick, I discovered how to overcome the problem that guests need to log in before they are allowed to write anything in the channel. You must remove the mode-flag “moderated” from the channel. Only the “broadcaster” (or in IRC lingo “channel operator”) can do that. That means you.

Here’s how to do that.
From the ustream show page: write "/mode #patrickmccb -m"
From Mirc: write "/mode #patrickmccb -m"
From your perl script: send a string to server "MODE #patrickmccb -m"
using the perl command: print $sock “string”;

The wisdom is sourced in this RFC 1459.

They should have used your

They should have used your robot for this patrickmcabe
http://rwcc.g-star.com/

 

That would have been cool :).

That would have been cool :).

Just a little update. I hope

Just a little update. I hope to get it up and running this weekend, but no promises. 

I have been working on getting the Perl script to do more of the work that the chess bot code would have to do instead. So now the perl script sends the chess bot the exacte numbers that will be inputed into the gantry crane moving functions to move the crane to the correct position, move the piece, and return to the start position (a8). I wrote this today and will be testing and debugging tomorrow. Once it can move pieces fine, and i get the “killing” function in the perl script too, then it will go live. After that it would be a matter of adding to the perl script so i can control who is playing chess, remove players, add players, etc. 

Oh and i will have to write a short post on the operation of the internet bot.