Robot can detect black tile without backing up correctly
When detecting a black tile, isBlack
will be set true as soon as some black is detected, but the remaining distance is not updated until it is "confirmed" (when it breaks out). However, if the robot finishes moving the 30cm before the black is "confirmed," the robot will still mark the cell as black and move itself back in its map, without physically backing up the right length because the remaining distance was not updated.
Solutions:
- Do not detect black if sampling interval was cut off by finishing early
✅ - Special case with additional confirmation
❌ - Moving is necessary to actually get different readings, and if the robot hasn't detected black by this point, either calibration is wrong (not the code's fault) or it isn't actually black
- Update distance remaining distance continuously to accept finishing early on black instantly
❌ - See above reasoning
Edited by Ethan Wu