Problem
Sliding-tile puzzles require iterative manual moves to reach a solved state. Solving them robotically demands three things working in concert:
- Real-time vision to detect puzzle state from arbitrary camera angles
- Optimal path-finding to compute the minimal move sequence
- Precise actuation to execute moves autonomously
Solution
TubeSort integrates computer vision, algorithmic search, and precision robotics into a single autonomous system. A Raspberry Pi-driven CNC gantry photographs the puzzle, analyzes it via OpenCV, solves it with a DFS backtracking algorithm, and executes moves through stepper motors and a servo gripper.
Implementation
System Architecture
Vision Pipeline
Key Steps:
- Capture: Raspberry Pi Camera mounted above puzzle board
- Perspective Correction: Normalize board geometry from arbitrary angles
- Tile Detection: Contour analysis isolates individual pieces
- Color Classification: K-Means clustering identifies tile colors robustly
Solver
Algorithm:
- Convert detected tiles into searchable puzzle representation
- Explore move trees via depth-first backtracking
- Output ordered list of tile swaps for execution
Actuation
Components:
- Stepper Motors: Drive XY gantry to position gripper over target tile
- Servo Gripper: Z-axis lift, move, and place operations
- GPIO Control: Real-time command execution from Raspberry Pi
