Re drive_cm() with timeout: Perhaps if things had not gone as well as they did.
I added a silly millimeter to the dock staging distance, and have not run into this condition again. I’m up to 30 in a row successful test dockings headed into another “leave Carl running overnight” test.
The major reliability improvement came from making a rear castor guide, with a little reliability improvement through software - tuning the backing distance calculation. I only have 4-5 millimeters distance tolerance, and maybe +/- 3 degrees angle tolerance so I am actually very impressed with the GoPiGo3 system repeatability and accuracy.
The Distance Sensor variance is around 3%, and the measurement error is 3% at close distances. I average out the variance with multiple readings, and run the average through a distance measurement error linear equation so that I can measure the +/- 6 millimeter variance to within 1mm when positioning Carl in front of the dock. Factoring the measured position into the backing distance calculation with some more magic allows Carl to back onto the dock with a precision usually only possible with stepper motors and sticky wheels on a heavy platform.
My premiere design principles are “Plan for errors” and use the basic platform to the fullest before using more sensing. Humans don’t measure where we are exactly, and somehow we make it from the bed to the bathroom with mostly closed eyes. My Carl / GoPiGo3 is more capable in some aspects; I just have to figure out how to make him smart enough to use his capabilities to the fullest.