A simple python script that scans a Rubik's Cube, detects colors, and solves it using the Kociemba algorithm. The solution will be sent to an ESP32 later in the project for execution.
Make sure you have the following installed:
- Python
- OpenCV
- Numpy
- kociemba
You can install the required packages using:
pip install opencv-python numpy kociemba- Connect a camera or use an IP camera stream.
- Run the script:
python rubiks_solver.py
- Follow the instructions to scan all six faces of the cube.
- The program will process the scanned colors and output the solution.
- The solution will be sent to the Arduino, which will execute the moves.
- Press
cto capture the current face. - Press
rto restart scanning. - Press
qto quit the program.
The Rubik's Cube is manipulated using a set of standard move notations:
- U (Up) - Rotate the top face clockwise.
- U' (Up Inverse) - Rotate the top face counterclockwise.
- U2 - Rotate the top face 180 degrees.
- D (Down) - Rotate the bottom face clockwise.
- D' (Down Inverse) - Rotate the bottom face counterclockwise.
- D2 - Rotate the bottom face 180 degrees.
- L (Left) - Rotate the left face clockwise.
- L' (Left Inverse) - Rotate the left face counterclockwise.
- L2 - Rotate the left face 180 degrees.
- R (Right) - Rotate the right face clockwise.
- R' (Right Inverse) - Rotate the right face counterclockwise.
- R2 - Rotate the right face 180 degrees.
- F (Front) - Rotate the front face clockwise.
- F' (Front Inverse) - Rotate the front face counterclockwise.
- F2 - Rotate the front face 180 degrees.
- B (Back) - Rotate the back face clockwise.
- B' (Back Inverse) - Rotate the back face counterclockwise.
- B2 - Rotate the back face 180 degrees.
- Ensure proper lighting for accurate color detection.
- Position the cube correctly in front of the camera as guided by the interface.