Autonomous Rubik's Cube Solving Robot
A 6-DOF robot arm that autonomously scans, solves, and executes moves on a physical Rubik's cube using computer vision and a custom manipulation pipeline.
The Problem
We built a 6-DOF robot arm that autonomously solves a physical Rubik's cube end-to-end. The robot first detects the cube on a table using ArUco-marker-aided contour detection, picks it up, and scans all six faces by holding the cube above a USB camera. Color classification uses HSV masking with dual-range red handling and secondary RGB disambiguation, plus consensus voting over multiple frames to reject noise. The scanned state is fed to a Kociemba optimal solver, and the brain node then orchestrates the full solve sequence: for each move, it computes the shortest reorientation primitive sequence (tip or spin via drop-and-pickup), seats the cube in a 3D-printed jig that constrains the bottom layers, and twists the top face by rotating the wrist. A 10 Hz callback-based state machine (INIT → SCAN → SOLVE → FINISH) coordinates the pipeline, with a RECOVERY state that re-scans on solver failure. The trajectory executor runs a 100 Hz servo loop with gravity compensation for smooth, accurate motions throughout.
Approach
The system is decomposed into four ROS nodes: a brain state machine (10 Hz) for high-level sequencing, a trajectory executor (100 Hz) for interpolated joint-space motion with gravity compensation, a cube detector for ArUco+contour-based pose estimation with residual map correction, and a face/sticker detector using fixed-grid HSV classification with consensus voting. Cube orientation is tracked via a permutation table that updates after every reorientation primitive, allowing the solver to always know which logical face occupies each physical position. The drop-and-pickup reorientation strategy proved surprisingly robust, and the wrist-snap optimization on the first solve move saves a full manipulation cycle.
Results
