Chess-Competition

In this project, I worked with one other person to have a robot compete against a human in chess. The project - Chess-Competition - uses a simplified method to create a chess game experience between a UR5 robot arm and a human player. A perception process was created in order to mitigate the error during the piece recognition process by using OpenCV to recognize different colors of the chess pieces.

Using an RGB picture of the current board layout, it masks all colors except the specific blue and red of the chess pieces to locate the positions of those chess pieces. It then determines its moves based on the chess pieces' positions on the board. The program stops when either the player or the robot wins.

In Chess-Competition, there are three different forms of information about the chessboard used. The first form is in the form of a virtual chessboard inside the program, written with FEN (Forsyth–Edwards Notation), so that the chess engine can recognize the position of each chess piece later on. The second form is the actual chessboard, in which the program stores information about the real game situation. The last form is a simplified chessboard which is stored as 8*8 matrix. This form stores color information of each position.

I worked on the image processing of the physical chess board. When the human player moves a piece, the information on the actual chessboard is converted into a new simplified chessboard by using OpenCV. OpenCV recognizes different colors on each position of the actual chessboard, and saves them into a single 8x8 matrix. This 8x8 matrix houses the positions of the humans' pieces and compares it to the previous positions to calculate what the human moved. From there, this information is then sent to the chess algorithm - Stockfish 10 - for the robot to calculate its next move.

The code can be found on Github

Stockfish 10 engine: here