{"id":16879173,"url":"https://github.com/robertlucian/rubiks-cube-solver","last_synced_at":"2025-04-11T11:41:13.997Z","repository":{"id":40982179,"uuid":"184644192","full_name":"RobertLucian/rubiks-cube-solver","owner":"RobertLucian","description":"The software that solves the Rubik's Cube on a physical machine","archived":false,"fork":false,"pushed_at":"2022-11-22T03:55:30.000Z","size":30887,"stargazers_count":6,"open_issues_count":3,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T08:01:44.065Z","etag":null,"topics":["gui","pivotpi","python","robot","rubik-cube","rubiks","rubiks-cube","rubiks-cube-solver","tkinter"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RobertLucian.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-02T20:04:27.000Z","updated_at":"2024-03-19T16:14:46.000Z","dependencies_parsed_at":"2023-01-23T16:15:27.159Z","dependency_job_id":null,"html_url":"https://github.com/RobertLucian/rubiks-cube-solver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobertLucian%2Frubiks-cube-solver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobertLucian%2Frubiks-cube-solver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobertLucian%2Frubiks-cube-solver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobertLucian%2Frubiks-cube-solver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RobertLucian","download_url":"https://codeload.github.com/RobertLucian/rubiks-cube-solver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248385504,"owners_count":21094900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gui","pivotpi","python","robot","rubik-cube","rubiks","rubiks-cube","rubiks-cube-solver","tkinter"],"created_at":"2024-10-13T15:52:59.670Z","updated_at":"2025-04-11T11:41:13.974Z","avatar_url":"https://github.com/RobertLucian.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rubik's Cube Solver Robot\nThe software that solves the Rubik's Cube on a physical machine.\nThe detailed post on how this robot works can be found [here](https://www.robertlucian.com/2019/07/06/rubiks-cube-solver-robot/).\n\nAn example of the robot scanning and then solving the Rubik's cube is shown in the next video.\n\n[![](https://img.youtube.com/vi/GnsUHpGSF7Y/0.jpg)](https://www.youtube.com/watch?v=GnsUHpGSF7Y)\n\n## GUI App\n\nThe GUI app has 3 tabs. These tab-accessible pages can be seen in the following images.\n\n![Imgur](https://i.imgur.com/KhlXPts.png)\n\n![Imgur](https://i.imgur.com/K8V70SQ.png)\n\n![Imgur](https://i.imgur.com/kiGKdsw.png)\n\n### Overall Architecture\n\nThe architecture of the program is shown in the following diagram.\n\n![Imgur](https://i.imgur.com/7xYaAOD.png)\n\nThe FSM (*Finite State Machine*) observed in the above diagram as a thread is described next.\n\n![Imgur](https://i.imgur.com/tNn3mIl.png)\n\n### Source Code\n\n1. In the `hw` directory, all the CAD components and assemblies are found. They were designed in SolidWorks.\n\n1. In `rubiks_solver` directory, the source code of the program that runs on the robot is found. In there, there are 2 core modules. Alongside these 2 modules, there is also a `config.json` file and modules needed to make the PivotPi to work (the servo controller).\n\n    * `arms.py` - a module which hosts the classes needed to map a solution of a cube to a list of sequences that have to be directly applied to all 4 arms of the robot. The classes are particularized to the given robot.\n\n    * `main.py` - the main script which upon launch spawns the GUI app and also runs in the background different threads needed to scan or solve the cube.\n\n##### Things to consider when running the GUI app:\n\n1. The configuration of the robot can only be updated when it's found in the rest state - aka when the servos are stopped.\n\n1. The configuration file written `config.json` must have all fields already present upon the app's launch. In this repo, all required fields are already present.\n\n1. Pressing the *Release/Fix/Stop/Cut Power* buttons will execute as many times as they are pressed and in the same order as they were pressed.\n\n1. When calibrating the camera or the arms, click on *Save* to propagate the new configuration throughout the app and also to save it to disk.\n\n### Installing\n\nUpdate the package manager:\n```bash\nsudo apt-get update\n```\n\nNumpy/Sklearn Dependencies:\n```bash\nsudo apt-get install gfortran libatlas-base-dev libopenblas-dev liblapack-dev\n```\n\nDependencies for Pillow:\n```bash\nsudo apt-get install libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 -y\n```\n\nDependencies for muodov/kociemba library:\n```bash\nsudo apt-get install libffi-dev python-dev python3-dev\n```\n\nDependencies for OpenCV:\n```bash\nsudo apt-get install libcblas-dev libhdf5-dev libhdf5-serial-dev libatlas-base-dev libjasper-dev libqtgui4 libqt4-test libwebp6 -y\nsudo apt-get install libatlas3-base libsz2 libharfbuzz0b libtiff5 libjasper1 libilmbase12 libopenexr22 libilmbase12 libgstreamer1.0-0 libavcodec57 libavformat57 libavutil55 libswscale4 libqtcore4 -y\n```\n\nThen, after having installed the dependencies, go on and install the actual libraries:\n```bash\nvirtualenv -p python3 .venv # this has been tested against 3.5\nsource .venv/bin/activate\npip install -r requirements.txt --index-url https://piwheels.org/simple --extra-index-url https://pypi.org/simple\n```\n\n### Usage\n\nTo run this, execute\n```bash\npython main.py\n```\n\nThis launches a GUI app, so be sure you've got an X11 client running on your computer if you're running this headless.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertlucian%2Frubiks-cube-solver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobertlucian%2Frubiks-cube-solver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertlucian%2Frubiks-cube-solver/lists"}