Tic-Tac-Toe

I have created a program that allows a skid/steer LEGO robot play the game Tic-Tac-Toe. The program can be download directly from the RobotNav Github account as explained before.
The robot uses a marker to draw the playing grid and to make its moves. The user selects its moves using the brick buttons or the keyboard. I installed two gyros on the robot one from LEGO (right side) and one form Microinfinity (left). They can be enabled in software. The program can be downloaded and compile as explained before.

TicTacToeEv3Robot

Before starting the game, the user must initialize the robot/marker. The marker must be moved until it touches the ground. Users should quit the program at this point and the robot will be ready to start game. The robot always starts and draws an X in the center, the user can then select the next move, which will be drawn as a circle by the robot. The input method can be either using the computer keyboard through a terminal (#define INPUT_KEYBOARD). During the initialization part the users can use the upper case “M” or lower case “m” to move the marker up or down. During the game, the numbers 0 to 8 will represent the location of the user move in the grid counting left to right and down to top:

grid_location

Alternatively, the users can use the brick buttons (#deine INPUT_BUTTONS). Notice that in order to avoid issues when using this mode, the program must be called directly from the menu as explained before. The top and bottom buttons are used to control the marker location during initialization:

lego_ev3_buttons

The move location is defined by selecting a single button or combination of them followed by the center button:

lego_ev3_buttons

The program can be compiled to use any of the following three position estimation configurations by defining the appropriate mode:
– Simple odometry (#define NO_GYRO),
– Lego gyro (#define LEGO_GYRO)
– Microinfinity XG1300 gyro (#define LEGO_GYRO)

As explained before, users should expect to have the poorest results using simple odometry method (not shown below). The results using the Microinfinity XG1300L are consistently very good, and creates a very realistic game play as shown here:

LegoEv3GyroMicroinfinityTicTacToe

When using the LEGO gyro I found that in many cases the rotation estimations are accurate for a few seconds immediately after power it up.  But the errors soon accumulate to a point that makes the localization solution very inaccurate. The photo below shows the outcome of the robot describing the exact same moves played with the Microinfinity gyro.

LegoEv3GyroTicTacToe

Building Instructions

IMG_20160306_164212

IMG_20160306_164151 IMG_20160306_164102IMG_20160306_164151

IMG_20160306_164035

IMG_20160306_163637IMG_20160306_163727

IMG_20160306_163707 IMG_20160306_163747