ev3dev / ev3dev-lang-python-demo

Python Demo Programs
MIT License
60 stars 28 forks source link

MINDCUB3R #18

Closed IrishClanger closed 6 years ago

IrishClanger commented 6 years ago

Hi. Thanks for this great resource! I am having difficulty getting MINDCUB3R working. The ev3dev-lang-python library no longer includes a demo directory with MINDCUB3R in it. I tried downloading your ev3dev-lang-python-demo library, creating a demo directory under ev3dev-lang-python and copying MINDCUB3R into it but it has not worked. Your instructions say to run rubiks.py but the file is actually called mindcuber.py in your library which is not a big deal. I ran mindcuber.py but it is not finding the ev3dev libraries it needs:

robot@ev3dev:~/ev3dev-lang-python/demo/MINDCUB3R$ ./mindcuber.py Traceback (most recent call last): File "./mindcuber.py", line 3, in from ev3dev.motor import LargeMotor, MediumMotor, OUTPUT_A, OUTPUT_B, OUTPUT_C, SpeedDPS ImportError: No module named 'ev3dev.motor'

I've tried playing with PATH and running it from various different directories but no luck.

Please advise what I need to do to get it running.

Thanks, Mark.

dwalton76 commented 6 years ago

Hi Mark, you've caught us in a transition period where we are updating the ev3dev-lang-python API and the MINDCUBER demo has been updated to use that API but it hasn't been published yet. It is an easy fix though all you need to do is install the new API...this should get you up and running

$ cd
$ git clone https://github.com/ev3dev/ev3dev-lang-python.git
$ cd ev3dev-lang-python
$ sudo python3 setup.py install

after that try running mindcuber.py again and it should work...if not let me know.

Can you file an issue here about the README being incorrect in that it refers to rubiks.py instead of mindcuber.py? I recently renamed the file but forgot to update the REAMDE.

WasabiFan commented 6 years ago

Err, I would suggest not doing that. It has a couple issues:

Instead, I would suggest either switching to the preview builds of ev3dev (ev3dev-stretch) or using the version of the demos from the "Jessie" branch of the ev3dev-lang-python repo.

We need to add better documentation so that people don't get confused by this.

IrishClanger commented 6 years ago

Thanks for the answers! I googled how to clone a branch and used the older Jessie branch instead as that is what I am running. The first couple of tries failed to work out the colours (a big problem with the official MINDCUB3R program at the moment) but I lowered the lighting and it solved the cube the next time, though failed to flip properly near the end of the 21 steps. I ran it again and it finished off the cube with a 6 step solution correctly. Awesome! It will be interesting to see if the new version with the calibration feature performs more consistently in different lighting - an issue the main program has. The movements of the arm were slower than the official program but that is possibly more reliable. I like that you see a bit of what the code is doing on the screen - I ran it from the terminal on my MacBook. Does the program have any options for making patterns or re-shuffling the cube like the official version? Thanks for the help. I'm excited to show it to my son and see what else I can do with ev3dev. Sounds like I might be best to wait a little for the new API versions to emerge.

dwalton76 commented 6 years ago

Getting the colors correct should be better in the master branch but as wasabi pointed out you'll need to be on stretch to run that.

Making patterns...we don't support that right now but it should be easy to add...please file an issue for it. If you want to work on adding that feature and submit a pull request we would welcome it...I no longer have MINDCUBER assembled.

dwalton76 commented 6 years ago

PS If you look in /tmp/ there will be an HTML file you can view to see what colors we got from the colorSensor