[[ChessGame.mehtaatur.py]]

Alessandruino

9 years 9 months ago

Hey Mehtaatur, check if this script works for you... maybe i fixed it... let us know !!!

P.S. i would upgrade as soon as possible to BETTER FASTER STRONGER new MRL ;)

mehtaatur

9 years 9 months ago

Hey Al,

this script is not working completely just like the 1 which I had posted.

the problem is that I am not able to get the data from "computerMoved" into function "voice" even though I have written this line

chessgame.addListener("computerMoved", python.name, "voice")

Well but if I rename the function voice() as def input(): then the function would work.

Alessandruino

9 years 9 months ago

It works for me.... I can hear the voice Saying the computer moves

Send no worky after running the new file and playing a bit

mehtaatur

9 years 9 months ago

Hey Al,

I tried the above script with the latest MRL v1.0.24

in this version, the moves sent from arduino via serial and not understood by the chess service hence it dsnt register the moves. 

If I play the game on chess GUI with mouse, I do not get voice feedback of the moves played by computer, which i think should work beacuse i have wrriten this line: 

chessgame.addListener("computerMoved", python.name, "voice")

I sent a NoWoky.

GroG

9 years 9 months ago

It's been a long time .. welcome back !

Testing with what Alessandruino posted I get the voice played when I play with the computer in the gui.

AHahahah ... cool..  script mehtaatur ...  I get the same results as Alessandruino .. "Computer played queen from A4 to H4" ... sounds good :)

I don't see any errors in your log.. but I don't see the voice either 

Below is a part of my log...

 

155745 [Thread-31] INFO  class org.myrobotlab.control.ServiceGUI  - cleanMove Qh4-e4
3155745 [chessgame] INFO  org.myrobotlab.service.ChessGame  - computerMoved Qh4-e4
3155745 [Thread-31] INFO  class org.myrobotlab.control.ServiceGUI  - cleanedMove h4e4
3155745 [Thread-31] INFO  class org.myrobotlab.control.ServiceGUI  - Qh4-e4  from 39  to 36
3155745 [Thread-31] INFO  class org.myrobotlab.control.ServiceGUI  - getPos h4e4
3155745 [Thread-31] INFO  class org.myrobotlab.control.ServiceGUI  - getPos e4
3155745 [Thread-31] INFO  class org.myrobotlab.control.ServiceGUI  - Qh4-e4 pfrom 39 pto 36
3155745 [log] INFO  org.myrobotlab.service.Log  - log message from chessgame.[Ljava.lang.Object;@6e56977e
3155746 [python_input] INFO  org.myrobotlab.service.Python  - setting data msg_chessgame_computerMoved
3155746 [speech] INFO  org.myrobotlab.service.Speech  - audioFile\google\en\audrey\Computer played Queen from h4 to e4.mp3 is missing 
3155747 [speech] INFO  org.myrobotlab.service.Speech  - http://translate.google.com/translate_tts?tl=en&q=Computer%20played%20Q…
3155747 [speech] INFO  org.myrobotlab.service.Speech  - http://translate.google.com/translate_tts?tl=en&q=Computer%20played%20Q…
3155753 [chessgame] INFO  org.myrobotlab.service.ChessGame  - Qh4-e4
3155754 [chessgame] INFO  org.myrobotlab.service.ChessGame  - xh4e4nz
3155755 [Thread-31] INFO  class org.myrobotlab.control.ServiceGUI  - Check!
She should say CHECK !  :D

mehtaatur

9 years 9 months ago

Thanks Guys for your quick replies,

Since the script isnt working, Ill try it now on my desktop....

will post back in some time....

mehtaatur

9 years 9 months ago

Hey guys,

I figured how the script worked for you guys, since you were not having an arduino connected for sending moves via serial, it seems to work. It worked for me too when I gave input from GUI keeping the arduino disconnected.

But when my arduino is connected for sending in the moves I get voice feedback of only the user's moves and the voice feedback of computers move dosent work. 

I tried setting few  print flags in the script to see how the code is executed, figured out that when arduino is connected the function voice() is never executed, only function input() is executed.

If it isnt too much trouble could one of you please run the following serial communication code on your arduino along with this script on MRL, I guess that would show you exactly the same output how I am getting only User's played feedback and not the computer's play feedback.


void setup() {
  
  Serial.begin(57600);
  
}
 
void loop() {
  
  delay(5000);
  Serial.println("Handshaking Serial Communication");
  delay(5000);
  Serial.println("a2a4");
  delay(12000);
  Serial.println("b1c3");
  delay(12000);
  Serial.println("f2f4");
  delay(12000);
  Serial.println("g1h3");
  delay(12000);
}

P.S. I am using an older MRL v1695 because the above MRL script gives me error while reading incoming serial bytes.

 

 

If without the arduino , the voice part works, it means that is the input part which is not very good... I ll test with an arduino to reproduce the problem on your computer..

I'll test too.. soon as I get some time.. I've been busy with other tests and improving the Serial functionality -
here's a screen shot of the new improved Serial Service

If I get it done in a reasonable amount of time - you won't need the Log service anymore

Hey mehtattur...tested with the arduino and noticed some bugs :

  1. def input() function wasn't worky in receiving and decoding the bytes coming from the serial service (arduino) , so i added a counter to read  and parse four bytes (deleting the 10 and 13) and then to send them to the chess service
  2. the arduino sketch contained "handshaking serial connection" which borked the parsing in python so i deleted it (just moves have to be sent)
  3. the time between "serial" moves was too short, because the chess engine needs time to think and then google speech syntesis service needs time too.. so what happened was that the chess engine received 2 moves in a very short time ( BOOOOM !) 

I updated the python script (Chess.mehtaatur.py) which is shown on the top, and here is the arduino script you should use :

void setup() {
  
  Serial.begin(57600);
  
}
 
void loop() {
  
  delay(10000);
  Serial.println("a2a4");
  delay(25000);
  Serial.println("b1c3");
  delay(25000);
  Serial.println("f2f4");
  delay(25000);
  Serial.println("g1h3");
  delay(25000);
}

mehtaatur

9 years 9 months ago

Hey Alessandruino,

Firstly Thanks a lot for removing your time and helping me with the script and other things laugh

Regarding the bugs which you found in def input(), I guess that was the reason this script was not working with the newer releases and I had to use v1695. But finally I can use the latest MRL yes

For the Arduino code, actually whenever I establish communication between Arduino and MRL one move command is required for establishing comms, so I worte that in test code, but ill take care that I send only moves. 

Actually an update on this project is long due from my side, Ill make a post regading what all has happend with this project along with pics of the hardware.

Ciao!

 

mehtaatur

9 years 9 months ago

Yes Al, this is WORKY!!! yes

Yipee!!! laugh

Marked as solved.

I am making a few changes so that it would give more functionality with the hardware board.... Ill update you :)

kmcgerald

9 years 9 months ago

I always thought this was an interesting project because it is so different than the other traditional robot projects that most of us work on.