loading
 
Problem with setting variables
Jesper Borg from Sweden  [3 posts]
15 year
Hello! Im using RoboRealm to play tictactoe versus my robotic arm. I use a webcam to watch the board. This image is then converted to a black and white 3*3 pixels image. If i put a marker on the board in the first square then pixel 1 goes black then RoboRealm clicks on that corresponding box in a program which communicates with the robotarm. This works great! :-) However RoboRealm  it continues to click this box without interuption. I try to set variables called sqr# = 1 the first time RoboRealm recognize that a pixel now is black. It should after this not click if sqr# = 1.
Cant quite figure out why it does this and where the problem is.
Well maybe it makes more sense if you could please take a look in the attached robo file. Also attached is the picture that my webcam sees.
Thanks!

 

program.robo
Anonymous 15 year
Jesper,

Nice app!

The issue is in sqr8 and sqr9. In the SetVariable module where you set them to one you have the "Set once" checkbox checked. This causes those variables to only be set once per Run invocation. Simply unchecking this box in both those SetVariable modules will stop that multiple click issue.

Also, if you want to extend this you may want to use the GetPixels routine in a VBScript module to get direct access to the 3x3 pixel array. This might be easier to maintain. If you see the Marble Maze tutorial we use that on a 16x16 image to read pixels directly under programmatic control. But your solution also works ... !

Thanks for the image and robofile! Its a fun application.

STeven.
Jesper Borg from Sweden  [3 posts] 15 year
Thank you for your input. However after correcting the SetOnce checkbox, the application now doesn't click at all. After a lot of thinking I can't quite figure out why. Everything seems correct to me. I'm attaching the updated robo file if there's anyone out there with a clue.
program.robo
Anonymous 15 year
Jesper,

Something went very wrong with the mouse module from a previous update. This has been corrected and I verified that you script does appear to work. Can you download 2.1.1.6 and see if that helps.

Thanks,
STeven.
Jesper Borg from Sweden  [3 posts] 15 year
It's working, thanks a lot!

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index