ev3dev / ev3dev-lang-python

Pure python bindings for ev3dev
MIT License
422 stars 146 forks source link

MINDCUB3R: ValueError: 'ERROR:' is not in list #349

Closed chaNcharge closed 6 years ago

chaNcharge commented 6 years ago

Whenever I run rubiks.py through the brick's interface, it scans like normal, however, after it finishes scanning, it returns this error and stops:

2017-09-06 02:06:28,294    rubiks.py     INFO: Action (kociemba): ERROR: parity error U' L B2 L' U L D F2 D' B2 D L2 U L2 F2 D'
2017-09-06 02:06:28,324    rubiks.py     INFO: Move 0/19: ERROR:3 (a 'ERROR:')
2017-09-06 02:06:28,339    rubiks.py     INFO: move() face_down ERROR:
2017-09-06 02:06:28,361    rubiks.py    ERROR: 'ERROR:' is not in list
Traceback (most recent call last):
  File "./rubiks.py", line 581, in <module>
    rub.resolve()
  File "./rubiks.py", line 522, in resolve
    self.run_kociemba_actions(actions)
  File "./rubiks.py", line 505, in run_kociemba_actions
    self.move(face_down)
  File "./rubiks.py", line 468, in move
    position = self.state.index(face_down)
ValueError: 'ERROR:' is not in list
2017-09-06 02:06:28,434    rubiks.py     INFO: Shutting down 

This doesn't happen when I connect the brick to my computer and run it remotely using ssh.

dwalton76 commented 6 years ago

Hmmm, my guess is rubikscolorresolver is getting the colors wrong and is producing an invalid cube that the kociemba solver then barfs on. Can you add the /tmp/rubiks-color-resolver.html file to the ticket here? That will have the RGB values (per the color sensor) for each square and what we think the final color is for each square.

chaNcharge commented 6 years ago

Here's the html file, I looked at it myself, and it does seem to be an invalid cube. Which is strange, but I guess it really depends on the lighting?

https://drive.google.com/file/d/0B3ZoX-8LP704SkRPSUNrN2hMOVU/view?usp=sharing

chaNcharge commented 6 years ago

I did some more testing, the interface isn't the issue, it's just that the scanning is a little bit unreliable, very particular about lighting.

ddemidov commented 6 years ago

When I played with mindcub3r, I found it depends a lot on the cube coloring. On my old cube the sensor had difficulty distinguishing between orange and yellow for example.

dwalton76 commented 6 years ago

oh wow those colors are really dark, I don't know that I could pick out the reds vs. oranges there. Can you put a lamp nearby and see if that helps?

I can fix a couple of things though:

chaNcharge commented 6 years ago

I put the cube in a much brighter location, and it successfully solved the cube. I guess it really depends on lighting? Still looks kinda dark though, I'll try different locations. https://drive.google.com/open?id=0B3ZoX-8LP704X1hmM3AzRExTakE

dwalton76 commented 6 years ago

I wonder if the color sensor normally returns dark values? The web page for debugging is something I added to rubikscolorresolver after I took my MINDCUBER apart so I don't have a point of comparison. If you put a lamp right over the top of mindcuber do the colors from the color sensor still look so dark?

Having a lot of light will help a lot. If you are using a webcam you have to worry about too much light and glare but with the color sensor the more light you can put on it the better (in my experience).

dwalton76 commented 6 years ago

Pull request posted to have rubiks.py exit cleanly when kociemba returns an ERROR. Also opened https://github.com/dwalton76/rubiks-color-resolver/issues/2 to have rubiks-color-resolver always return a valid 3x3x3 cube so that kociemba won't barf in the first place.

chaNcharge commented 6 years ago

Well using the original program and rgb block doesn't return dark values, but for now, it's probably just very particular about lighting

dwalton76 commented 6 years ago

fixed

dwalton76 commented 6 years ago

@chaNcharge if you re-install rubiks-color-resolver it will pick up the fix for https://github.com/dwalton76/rubiks-color-resolver/issues/2

With that I am able to get the colors correct for the cube you sent the other day, the one that caused kociemba to barf.