Chess playing robot

Discussion specific to projects ideas and support.
Post Reply
combatil
Posts: 3
Joined: 18 Sep 2012, 21:10

Chess playing robot

Post by combatil »

Hi all,

I've been active long ago on the old NXTasy forums, and I just made a robot that I wanted to share and I thought you guys might be interested.
It's a chess playing robot, here it is:




The programming was done in MATLAB using the RWTH toolbox.
It was a good opportunity to me to learn it a bit (MATLAB) this summer, as I am an EE student and I'll probably use it extensively later on ..
Anyway, I hope you like it :)
Last edited by combatil on 20 Sep 2012, 06:48, edited 1 time in total.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: Chess playing robot

Post by HaWe »

aaah...poor... NXT just remote controlled by a PC.... :?
(just kidding!)^^

here's an autonomous NXT chess robot! All chess moves calcultaed by a self-written chess move generator runnning on 1 NXT, and the robot hardware is controlled autonomously by 2 NXTs ! :mrgreen:

chess program, written in NXC for the Lego Mindstorms NXT.
The chess program is executed on the first NXT, the 2nd NXT is needed additionally for controlling the robot arm hardware (communication to each other via bluetooth).
The chess moves may be chosen manually (via buttons and shown on the virtual chess board on the display), or the moves can be calculated automatically by the AI chess move generator running autonomously on the NXT (no connection to any PC or to a different host).

Robotic arm hardware by Fischertechnik and Lego Technic / Mindstorms.

Schach-Programm, geschrieben in NXC für Lego Mindstorms NXT
Das Schachprogramm läuft auf einem der NXT's, zusammen mit einem 2. über Bluetooth verbundenen NXT wird dabei ein Schachroboter gesteuert.
Sowohl die manuellen als auch die wahlweise automatisch generierten Züge werden anschließend über den Robot ausführt .
Das gesamte Programm läuft autonom auf den NXT's (also ohne Verbindung zu einem PC oder einem anderen Host).
Roboter-Hardware: Fischertechnik plus Lego Mindstorms
http://www.mindstormsforum.de/viewtopic ... 046#p57269

guess who built it? :ugeek:

(of course quite slow compared to a PC chess move generator.
But once when a multi-kernel-NXT-network will be established by rs485 running the move generator on 4 or more parallelized NXTs it will be faster by far!) 8-)

your move detection by a cam is really fine - I wish I could also do it by an autonomous cam like that one from Mindsensor's ...but no chance to do that!
combatil
Posts: 3
Joined: 18 Sep 2012, 21:10

Re: Chess playing robot

Post by combatil »

doc-helmut: that's an awesome robot!
The move evaluation algorithm you wrote is really nice too, and it's really cool the processing is done over 2 bricks.
I think professional chess engines also have an opening book incorporated into them, but I have no idea how much memory it takes, and whether it's a viable option on the NXT?
Of course there's a huge difference in computation power when using only NXT Bricks as opposed to a computer, so I was a little "careless" when using my available resources - I didn't really think about algorithmic efficiency, because for my project it wouldn't be noticeable, as opposed to yours - where each loop can take a few milliseconds (No offense to the NXT brick! :P)
Anyway, it will be interesting to see how the NXT handles image processing too. I mean, they sent a slower computer to the moon, so I bet everything's possible!
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: Chess playing robot

Post by HaWe »

yes, indeed most of the chess engines have an opening book (and e.g., move lists and chess positions in hash tables for many of the most famous chess games, particularly older ones and those for common players) .

Most of the new super-parallelized computer engines with Teraflops of calculating power don't still have this , they are calculating just by brute force alpha-beta search and maybe 20 moves or more ply search depth (like probably Deep Blue by IBM). When I'll be able to parallelize 4 NXTs in a multicore-network I guess with a ply depth of 4 move iterations, then 1 move will last about 5-15 minutes to be calculated.

Most of the calculation time of my own NXC chess move generator is used by NXC to copy the chessboard (char [128]) for each deepening to a global/local variable to be passed to the next deepening level function because NXC has got neither pointers nor pass-by-reference (and no recursions neither). :?
A real "pass-by-reference" using pointers would probably accelerate this calculation speed by 50 or 100 or more. I assume this could be achieved, e.g., by real ARM machine code for the NXT. Anyway - even then it would never be competitive to commercial computer chess programs/boards.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: Chess playing robot

Post by HaWe »

ps -
BTW: how did you calculate the moves of your robot arm to find the points to grab the pieces? look-up table or inverse kinematics?
combatil
Posts: 3
Joined: 18 Sep 2012, 21:10

Re: Chess playing robot

Post by combatil »

doc-helmut wrote:ps -
BTW: how did you calculate the moves of your robot arm to find the points to grab the pieces? look-up table or inverse kinematics?
Inverse kinematics! I didn't know that there was a name for this, but I googled it and that's exactly what I did :)
It's pretty much a matter of simple trigonometry to get all the required degrees for the motors.

It's interesting that you mention a look-up table. It's definitely possible because there are only 64 discrete options here, so theoretically it shouldn't take too long, and perhaps lead to a greater accuracy - because in the method I used, it wasn't too "perfect" - the farther away the arm was from its starting position, it actually distorted the whole structure and caused for some errors.
But using a lookup table could take those unexpected errors into account (assuming those are constant errors!)

So because my robot wasn't robust enough I was actually afraid there will be too much error due to distortion - but it worked fair enough! I guess a lookup table was my last resort though :)

What did you do for your robot?
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: Chess playing robot

Post by HaWe »

the farther away the arm was from its starting position, it actually distorted the whole structure and caused for some errors.
exactly my problem!
so I dropped it and made a look-up table... :)
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests