This morning I found my robot sad again.
The prior night he needed a recharge, and having discovered he was too far from “home base”, he had repeatedly asked: “MANUAL DOCKING REQUESTED”. Since the hour was late his rules prevented him from asking out loud, but I noticed him staring at the dock and not moving.
I placed him on the dock; made sure the indicator switched to charging, and then went to bed for the night thinking I had “helped” him.
This morning I found him still sitting on the recharge dock, but shutdown. He (and I) discovered that his rules for what to do after a manual docking were faulty.
I have to admit I didn’t retest every one of his 18 rules after making a “small reliability improvement” four months ago.
19th Rule added:
elif (chargingState == NOTCHARGING):
...
elif ((slope > 0) and \
(lastChangeInSeconds > 150) and \
(shortMeanVolts > longMeanVolts) and \
(shortPeakVolts >= longPeakVolts) and \
((shortPeakVolts - shortMinVolts)>0.5) and \
(dockingState == DOCKREQUESTED)):
chargingValue = CHARGING
lastChangeRule = "121"
Testing this one is a real pain - hopefully I won’t find a sad robot again.