Project Overview:
This is the third installment of the Joseph Hoane project. Named after the lead developer of DeepBlue's chess model that defeated Garry Kasparov, our project aims to achieve the same goal--only with no manual human inputs instrumented through a fully autonomous workflow.
Team Members:
What is the problem being addressed?
The autonomous robotic chess system will play against other robots on a physical board using a camera and computer vision to identify the current board state, a game engine with Stockfish to determine the best move, and a robotic arm that can physically execute the move on the board. Three subproblems arise with this setup:
1. Perception: How does a computer see and interpret a chess board from a camera feed consistently?
2. Decision: How does the system decide what move to make and manage the game accordingly?
3. Action: How does a robot arm physically pick up and place chess pieces accurately?
Solving these three problems concurrently creates an integrated pipeline that makes our chess robot autonomous. Where perception feeds decision, decision causes action, and action then loops back to perception for the next move. Every part of the system depends on one another, and bridging them together into consistent chess execution will be our main challenge.
Project Idea:
Modern-day chess engines exist only in software, moving imaginary pieces that never leave the digital confines of your computer. Our project catapaults the decision-making of the chess engine into physical reality. This process begins with a camera feeding in frames into a YOLO-based vision pipeline that detects every piece and empty square, encoding the calibrated board as a FEN piece-placement string. The game engine then validates the moves, tracks game state, and queries Stockfish for the best response. That move is then sent as a command to a UR10e robotic arm through a movement planner, which uses inverse kinematics and a PD controller to execute robotic movements crucial to gameplay. This dynamic loop repeats until a game result is met.
Implementation:
Computer Vision:
Computer vision is arguably the most vital part of this whole project. Without a working vision module, the rest of the components serve little use in achieving the goal of an autonomous chess robot. We went into this project with a provided vision module that we were told worked pretty reliably and would hopefully only need a few tweaks. Below is an image of the original vision module GUI setup as a reference point of where we started.
Old Vision Module GUI

This vision module had some pieces that were kept and modified. Specifically, the board calibration and transformation into the Birds-eye view were well implemented and only needed some touch-ups. But most other aspects of the vision were replaced. For example, the old vision module used a Yolo-v8 model, which was designed to take an entire image, break it down into regions, and draw bounding boxes around detected objects based on its training data. This approach did not work very well for our use case, as evidenced by the 0% accuracy we achieved during testing the initial vision module.
New Approach For Vision
Instead of trying to classify the entire image at once, we modified the existing board calibration sequence to split the board into 64 square images for each valid board position and passed them into a Convolutional Neural Network (CNN) using PyTorch. We used a pretrained CNN, mobilenet_v3_small, and collected training images to train the model using reinforcement learning, enabling it to become proficient at classifying chess pieces. We collected these images using the board and pieces we would eventually use to move the robot. This new approach allowed us to get the vision accuracy up to roughly 95%.
New Vision Module GUI

We made many visual changes to the GUI to make it look less cluttered, make the piece classification more visible, and enable better diagnostics of gaps in the training data. We also created a system to automatically capture and live-train data for the current board position by entering the board's current FEN notation, which allowed it to capture images and identify which pieces to label for training. This was done via a pop-up text box that appears when pressing V, which is shown below.

The Training Process
We collected a vast number of training images into a sorted directory, as shown below, along with an identical directory of validation images, which aren't trained on but are used to validate the effectiveness of the training data, in which most of the models we trained were able to classify 100% of the images in the validation set correctly.

To increase the amount of training data and make the models more robust to changes in lighting conditions, we also trained on 5 random variations of each image, as shown below.

Game Engine & Chess Logic:
The game engine is responsible for the full pipeline that connects the vision model and camera input to the robot movement, while implementing the ruleset and game flow of chess. The engine is run through a state machine that coordinates every component in sequence and prevents race conditions and incorrect game qualities.

Each turn begins with the vision module, as the camera continuously observes the board and produces a FEN string. A FEN string notates the arrangement of pieces and empty squares on the board, along with crucial game information like castling and move tracking. Vision accounts for placement, while the game engine must account for the remaining values. Rather than acting on a single frame, the engine requires the board position to be consistent across multiple readings before registering a move. This is executed through a stability window, which prevents reading in frames that are taken during movement or misclassification.

Once a stable FEN is confirmed, the engine validates it both structurally and semantically. It checks that the string is formatted correctly, and also that the position is physically legal and matches the result of a legal move made from the previous stable FEN. Each square on the board is computed, compared against previous positions, and checked for legality/stability. Once all checks have been made, and the position is deemed correct, then the state machine shifts to the ROBOT_THINKING state from WAITING_FOR_OPPONENT.
When the engine confirms a valid board position, it passes the FEN string to Stockfish through UCI (Universal Chess Interface) protocol. Stockfish is the strongest open-source chess engine, and it is always running as a subprocess. The game engine writes commands to its input stream and reads responses from its output stream. The engine sends the FEN and time allocated for calculation, where Stockfish then performs a search that reports depth, nodes evaluated, and score. After the allocated time has been used, Stockfish emits the best move in UCI format (example: e2e4) or game result if a termination condition is met.
The move command is then inputted into a JSON file that is then sent to the motion planner. This file includes source and destination squares, along with piece type, captured piece type, and flags for special moves (castling, en passant, promotion). Finally, the state machine transitions from ROBOT_THINKING to ROBOT_MOVING if the game continues, or GAME_OVER if the robot tied or lost the game.
Robotics & Movement Planning:
The robotics pipeline is tasked with executing the suggest move outputted by the game engine. Our robotics pipeline consists of two components: The motion planner and the command executor. The motion planner handles game space setup, parsing the suggested move from the game engine, and constructing the sequence of commands for the robot to execute. The command executor takes the sequence of commands from the motion planner and sends them to the UR10e arm and gripper.
Motion Planner
Calibration: We run a separate calibration script before running the full pipeline to record the tool center point (TCP) of various locations on and off the chess board. These include:
- Four Corner Squares: Used to map a precise spot for each board square to a specific (x, y) coordinate within the game space
- We use the corner of the square as it is easier to align the TCP consistently across the four squares
- Piece Pickup Offset: Used to set the offset from the precise spot to the center of a square
- Universal Hover Position: Used to set the upper-bounded z coordinate for collision-free movement across the game space
- Universal Lower Position: Used to set the lower-bounded z coordinate for fast lowering without piece collision
- Per Piece Lower Position: Used to set the various pick-up heights depending on the piece
Rest Position: Used for when robot is waiting for commands and placing captured pieces
Visualization of hover and lower position
Game Space Setup: We use the above calibration to set up the coordinates for the game space.
Geometric Homogeneity: Use rotation matrix to align simulation and real world axis
Joint Angle Match: Use simulation for inverse kinematics to ensure end-effector reach target location
Command Construction Logic:
- Starts at rest position →
- Moves to high position over initial square →
- Lowers to piece (depending on piece height) →
- Grab piece →
- Lifts to high position →
- Moves to high position over target square →
- Lowers to place piece →
- Release piece →
- Lifts to high position →
Back to resting position
Command Sequence Logic
Robotics
- Docker image
- Ubuntu 20.04 with ROS Noetic
- UR ROS drivers for UR10e manipulator communication
- pyserial for gripper communication
- Gripper
- Custom 3D-printed gripper with STS3215 USB Servo
- Uses pyserial to send raw serial bytes over USB to servo
- Abstracts away low-level details, only exposes small API:
- Enable: enable torque (keep servo position in place)
- Disable: disable torque (allow servo position to be moved, and reduce battery usage)
- Move [x]: move to raw value x.
- Our gripper lies in the range 3566 to 3931 for raw values. This is mapped from 0.0-1.0 to allow more intuitive control.
- 0.0 meaning open position, 1.0 meaning fully closed. Input can be any number between, allowing for piece dependent grip amounts.
- ROS Node
- Commands:
- Receives commands from planner through python's Multiprocessing.connection as a queue of 4-dimensional vectors
- For movement commands, input is [x,y,z,0], where (x, y, z) is the real-world Cartesian coordinate of the end effector (the gripper).
- For gripper commands, input is [t, 0, 0, 1], where t is the grip amount from 0.0 to 1.0, fully open to fully closed, respectively.
- Movement commands are batched into a single ROS message which automatically queues movements on the robot
- This is sent to the manipulator via a Publisher to the ROS topic: "/scaled_pos_joint_traj_controller/follow_joint_trajectory"
- Gripper commands are completed in order once all previous movement commands are finished
- Once the entire command sequence is complete, the planner sends a signal back to the game engine to continue the game via `robot_status.json`
- Receives commands from planner through python's Multiprocessing.connection as a queue of 4-dimensional vectors
- Read current positions:
- Using a Subscriber to the ROS topic: "/joint_states", we can read the position of each joint on the manipulator in real-time
- Outputs current robot arm position to `robot_joint_state.json` at a frequent interval (~100 milliseconds)
- Formatted as:
{
timestamp: 123456.098765432,
joints: {
"elbow_joint": 1.4412,
...
"wrist_3_joint": 0.23124
}
}
- Formatted as:
- Used for calibration process and debugging
- Commands:
Tech Stack:
Software:
- Operating System: Windows (development), Ubuntu (deployment)
- Chess Engine: Stockfish (UCI protocol, max strength)
- Game Engine/Logic: python-chess
- Programming Languages: Python 3
- Robotic Control: ROS 1, rospy
- Vision:
- OpenCV (camera capture, bird-eye warp)
- PyTorch (piece classification)
- torchvision (MobileNet V3 Small)
- scikit-learn (board corner detection)
- Simulation: MuJoCo
Hardware:
- UR10e Robotic Arm
- 3D Printed Gripper w/ Feetech ST3215 Servo
- ELP IFWATER Megapixel USB Camera
- MYNNNAT Tournament Roll Chess Set
Architecture:
Game Engine Diagram:

Vision Module Diagram:

Motion Planner and Robot Diagram:
