ev3dev-lang-python-demo icon indicating copy to clipboard operation
ev3dev-lang-python-demo copied to clipboard

Exception: There should be either 2 or 4 but we have [(side-R31-Gr, side-F24-Rd)]

Open guinasc2 opened this issue 5 years ago • 12 comments

Sorry to bother you again, but I need help. Now the solver scans the cube and returns a JSON with the readings, but then it returns me the following error:

''' 2019-12-06 14:15:38,943 mindcuber.py ERROR: There should be either 2 or 4 but we have [(side-R31-Gr, side-F24-Rd)] Traceback (most recent call last): File "./mindcuber.py", line 520, in mcube.scan() File "./mindcuber.py", line 380, in scan self.rgb_solver.crunch_colors() File "/usr/local/lib/python3.5/dist-packages/rubikscolorresolver/init.py", line 1806, in crunch_colors self.sanity_check_edge_squares() File "/usr/local/lib/python3.5/dist-packages/rubikscolorresolver/base.py", line 964, in sanity_check_edge_squares self.sanity_check_edges_red_orange_count_for_orbit(orbit_id) File "/usr/local/lib/python3.5/dist-packages/rubikscolorresolver/base.py", line 894, in sanity_check_edges_red_orange_count_for_orbit fix_orange_vs_red_for_color("green", green_red_or_orange_edges) File "/usr/local/lib/python3.5/dist-packages/rubikscolorresolver/base.py", line 799, in fix_orange_vs_red_for_color % target_color_red_or_orange_edges Exception: There should be either 2 or 4 but we have [(side-R31-Gr, side-F24-Rd)] 2019-12-06 14:15:39,776 mindcuber.py INFO: Shutting down '''

What should I do?

guinasc2 avatar Dec 06 '19 14:12 guinasc2

There is a file in /tmp/ called rubiks-color-resolver.html, can you attach that file to the issue here?

dwalton76 avatar Dec 06 '19 14:12 dwalton76

I can't find this file anywhere. Is there any /tmp/ inside another folder?

guinasc2 avatar Dec 09 '19 11:12 guinasc2

It should be /tmp/rubiks-color-resolver/rubiks-color-resolver.html

dwalton76 avatar Dec 09 '19 14:12 dwalton76

I still can't find it. Do you think I may have skipped any steps during the installation?

guinasc2 avatar Dec 10 '19 10:12 guinasc2

my bad, I just looked at the code and at some point I stopped writing the file to /tmp and started writing it in the current directory :( Look in the directory with mindcuber.py for a rubiks-color-resolver.html file.

dwalton76 avatar Dec 10 '19 12:12 dwalton76

I didn't find it in the directory. Do I have to do anything besides run the code for it to appear?

guinasc2 avatar Dec 10 '19 12:12 guinasc2

@dwalton76 Is there any reason this file wouldn't be there?

@guinasc2 Can you show us the output of the ls command?

WasabiFan avatar Dec 16 '19 04:12 WasabiFan

@guinasc2 can you re-install rubiks-color-resolver per the README at https://github.com/dwalton76/rubiks-color-resolver

Just to make sure you are running the latest and greatest

dwalton76 avatar Dec 16 '19 14:12 dwalton76

Same issue. Everything is installed per the instructions. Any ideas from here?

2020-02-03 03:46:22,521 mindcuber.py     INFO: RGB json:
{"1": [158, 213, 210], "2": [187, 201, 151], "3": [56, 63, 80], "4": [255, 225, 77], "5": [255, 255, 255], "6": [136, 55, 71], "7": [255, 255, 77], "8": [255, 177, 65], "9": [255, 196, 80], "10": [255, 94, 56], "11": [255, 255, 163], "12": [164, 213, 195], "13": [255, 65, 35], "14": [255, 240, 91], "15": [255, 255, 91], "16": [255, 82, 62], "17": [175, 199, 136], "18": [255, 255, 237], "19": [255, 255, 255], "20": [198, 255, 77], "21": [96, 121, 44], "22": [204, 255, 97], "23": [255, 255, 255], "24": [255, 225, 109], "25": [153, 250, 74], "26": [136, 174, 133], "27": [238, 140, 77], "28": [255, 255, 80], "29": [164, 208, 186], "30": [255, 255, 85], "31": [158, 255, 68], "32": [255, 255, 124], "33": [255, 255, 80], "34": [255, 143, 53], "35": [255, 167, 53], "36": [255, 233, 56], "37": [255, 255, 255], "38": [255, 255, 255], "39": [255, 255, 255], "40": [255, 255, 255], "41": [255, 255, 255], "42": [255, 255, 255], "43": [255, 255, 255], "44": [255, 255, 255], "45": [255, 255, 255], "46": [255, 213, 77], "47": [255, 255, 77], "48": [136, 85, 53], "49": [255, 255, 255], "50": [255, 255, 109], "51": [249, 155, 62], "52": [164, 255, 83], "53": [175, 255, 77], "54": [130, 155, 59]}

2020-02-03 03:46:28,345 mindcuber.py    ERROR: There should be either 2 or 4 but we have [(side-R29-Bu, side-U6-Rd), (side-B42-Bu, side-L13-Rd), (side-F26-Bu, side-D47-OR)]
Traceback (most recent call last):
  File "./mindcuber.py", line 520, in <module>
    mcube.scan()
  File "./mindcuber.py", line 380, in scan
    self.rgb_solver.crunch_colors()
  File "/usr/local/lib/python3.5/dist-packages/rubikscolorresolver/__init__.py", line 1806, in crunch_colors
    self.sanity_check_edge_squares()
  File "/usr/local/lib/python3.5/dist-packages/rubikscolorresolver/base.py", line 964, in sanity_check_edge_squares
    self.sanity_check_edges_red_orange_count_for_orbit(orbit_id)
  File "/usr/local/lib/python3.5/dist-packages/rubikscolorresolver/base.py", line 900, in sanity_check_edges_red_orange_count_for_orbit
    fix_orange_vs_red_for_color("blue", blue_red_or_orange_edges)
  File "/usr/local/lib/python3.5/dist-packages/rubikscolorresolver/base.py", line 799, in fix_orange_vs_red_for_color
    % target_color_red_or_orange_edges
Exception: There should be either 2 or 4 but we have [(side-R29-Bu, side-U6-Rd), (side-B42-Bu, side-L13-Rd), (side-F26-Bu, side-D47-OR)]
2020-02-03 03:46:28,778 mindcuber.py     INFO: Shutting down

Directory Contents

robot@ev3dev:~/ev3dev-lang-python-demo/robots/MINDCUB3R$ ls
cache  calibrate_white.py  __init__.py  max_rgb.txt  mindcuber.py  __pycache__  README.md```

mm738 avatar Feb 03 '20 03:02 mm738

@mm738 please attach the rubiks-color-resolver.html file, that has the info I need to try to figure out what happened.

dwalton76 avatar Feb 03 '20 15:02 dwalton76

@dwalton76 sure, what are the steps to enable it?

Currently it is not created. The below yields nothing.

robot@ev3dev:~/ev3dev-lang-python-demo/robots/MINDCUB3R$ sudo find / -name "rubiks-color-resolver.html"

mm738 avatar Feb 03 '20 15:02 mm738

@mm738 that is really weird. If you run this from the directory where your rubiks-color-resolver.py resides does it create the rubiks-color-resolver.html file?

./rubiks-color-resolver.py --rgb '{"1": [158, 213, 210], "2": [187, 201, 151], "3": [56, 63, 80], "4": [255, 225, 77], "5": [255, 255, 255], "6": [136, 55, 71], "7": [255, 255, 77], "8": [255, 177, 65], "9": [255, 196, 80], "10": [255, 94, 56], "11": [255, 255, 163], "12": [164, 213, 195], "13": [255, 65, 35], "14": [255, 240, 91], "15": [255, 255, 91], "16": [255, 82, 62], "17": [175, 199, 136], "18": [255, 255, 237], "19": [255, 255, 255], "20": [198, 255, 77], "21": [96, 121, 44], "22": [204, 255, 97], "23": [255, 255, 255], "24": [255, 225, 109], "25": [153, 250, 74], "26": [136, 174, 133], "27": [238, 140, 77], "28": [255, 255, 80], "29": [164, 208, 186], "30": [255, 255, 85], "31": [158, 255, 68], "32": [255, 255, 124], "33": [255, 255, 80], "34": [255, 143, 53], "35": [255, 167, 53], "36": [255, 233, 56], "37": [255, 255, 255], "38": [255, 255, 255], "39": [255, 255, 255], "40": [255, 255, 255], "41": [255, 255, 255], "42": [255, 255, 255], "43": [255, 255, 255], "44": [255, 255, 255], "45": [255, 255, 255], "46": [255, 213, 77], "47": [255, 255, 77], "48": [136, 85, 53], "49": [255, 255, 255], "50": [255, 255, 109], "51": [249, 155, 62], "52": [164, 255, 83], "53": [175, 255, 77], "54": [130, 155, 59]}'

The values above are from your RGB json output. The resulting html file is rubiks-color-resolver.html.gz

which shows the initial cube colors as: cube

Those are some pretty strange colors:

  • there appear to be 3 white centers and 3 yellow centers?
  • the entire back face is white?

Can you post a picture of the cube so I can get an idea of the color scheme?

dwalton76 avatar Feb 04 '20 04:02 dwalton76