Hi, i'm looking for information or documentation regarding sending chess moves back and forth (from arduino to comuuter and vice versa) using the serial. Thank you

GroG

6 years 5 months ago

Hi Greg,

I'm glad you are not the kind of person who gives up quickly, nor gets frustrated when things do not work.  This is an excellent trait to develop and will serve you well, sir.

Let us start with a bit of history.  It helps to understand how we got where we are now ...

The chess stuff was orignall developed for Patrick Maccabe - http://patrickmccabemakes.com/hardware/Chess_Robot_V2/

And then used by metaatur to develop his automated chessboard

http://myrobotlab.org/content/robotic-chess-board

http://myrobotlab.org/content/chess-automated-10-project-update

http://myrobotlab.org/content/chess-automated-project-update

Others have began similar projects

http://myrobotlab.org/content/chess-playing-robot-0

And they kickstarted "Square Off"

 

 

I added to the service script so that is writes "customMsgs" to the Arduino 

[[service/ChessGame.py]]

the script will do a couple of moves, and you'll see data being written to the virtual arduino 

Most of the output here is "heartbeat" - where the computer and the arduino make sure each is listening and attached.  But other messages (including the custom message) will be visible here.  They are also visible in the output of Python script below.

I've given you a lot more information.  Perhaps we could better assit you if we know your future goal is.
GroG

 

Thank you, Thank you, Thank you Gr0G, this was especially helpful. I'm working on a capstone project for my final year at the university, i spent a ton of time on the movement and sensing part of the project that i neglected the communication aspect. The ultimate goal is basically to play a game of chess via wi-fi on two remote chess boards (when i found mrl i though i struck gold). The detection mechanism at the moment is a capacitive sensor (i'm considering changing this), The movement is going to be handled by a 3d printer movement axis with the z-axis torn out and reprogrammed to hold a magnet with  would move the pieces undernesth the chess board based on commands from mrl. at the moment 'm using mrl as virtual chess board and building only one physical board. where the game will be phisically visualized

what i'm trying to do for now on mrl just to understand how things work:

Cause---> effect

Bob moves d2-d3 on his physical chessboard ---> mrl moves d2-d3 on chessgame service

Computer moves a2-a3 on chess game service---> Arduino in bob's physical board implements computer's move.

My new questions:

  • Why do the moves need to be encoded as integers(i'm assuming the customMsg method only takes in integers)
     
  • How does the arduino receive these messages. (what are the steps i'd need to take in the MRL comm sketch to receive these chess moves ("a2-a3" say) from mrl).
     
  • How would i go about sending a chess move from the arduino to mrl (move d2-d3 on chessgame service)

Goals in the longterm: 

I have a bunch of things i'd like to improve on, there's so much i'd exceed the allowable writing limit on this  reply. At the moment i'd just like to understand how most of mrl works to be honest and build this prototype.

Thanks again.

Why do the moves need to be encoded as integers(i'm assuming the customMsg method only takes in integers)

The chess game engine understands "HMove" object 
https://github.com/MyRobotLab/myrobotlab/blob/develop/src/org/myrobotlab/chess/HMove.java#L15
it has a "to" & "from" as ints
I would "guess" the values are square numbers 1 through 64 for a chessboard... its only a guess as I did not write the chess game engine.  It seems like a simple way to send movement information.  And yes arduino.customMsg(int[]) takes an array of integers.  You could send string values if you wanted to - but you would need to convert the string to an ascii character array - then convert to ints

How does the arduino receive these messages. (what are the steps i'd need to take in the MRL comm sketch to receive these chess moves ("a2-a3" say) from mrl).

 
To receive a message PC --> Arduino
 
 
How would i go about sending a chess move from the arduino to mrl (move d2-d3 on chessgame service)
 
To send a message from Arduino --> PC
use this method