Posted 06 March 2017
At this point in the 4WD robot’s development, I think it might be time to review all of Wall-E2’s different operating modes, and what external sensor conditions determine which operating mode is active. Previous to this point, the robot had only one operating mode – the ‘Wall-Following’ mode. Now that the new battery pack has been added, along with the new capability for homing in on an IR beam to connect to a charging station has been added, the robot operating system must be enhanced to manage the additional operating modes.
- Wall-Following: This is the ‘normal’ operating mode, active when nothing else is going on (no IR beam present, no charging voltage present)
- IR Beam Homing: Occurs when an IR beam is detected. In this mode, a PID controller determines wheel speeds in an attempt to home in on the IR source. This mode has two distinct sub-modes, depending on the battery state of charge. if the battery is relatively full, then the front obstacle avoidance distance is increased such that the obstacle avoidance turn will occur before the robot gets captured by the lead-in side rails. Otherwise, the obstacle avoidance distance is disabled entirely, allowing the robot to be captured and the charging connection to be made
- Charging: Occurs when the robot is connected to the charger. In this mode, the charging status lines are monitored to detect end-of-charge (EOC). When EOC is detected, the robot backs straight out of the lead-in rail area, and then turns 90º away from the nearest wall and transitions to wall-following mode.
Here is a draft state-transition diagram for the system
As can be seen from the diagram, the system starts out in the POST (Power On Self Test) state, and transitions to one of the other states depending on sensor input.
- If no IR beam is detectable, and the charging station is not connected, then the system transitions to the normal ‘Wall-Following’ state. The wall-following state continues until either an IR beam is detected, or a physical connection to a charging station is detected. The normal exit condition from the wall-following state is via detection of an IR beam, which causes transition to the ‘IR Homing’ state.
- In the IR Homing state, there are two possible behaviors; if the battery is more than 3/4 full (not quite sure how I’m going to define that, but…), then the robot will actively avoid the charging station by performing an obstacle avoidance 90º degree turn at a front distance larger than the extent of the charging station lead-in gate, and transitioning back to the ‘Wall-Following’ state. If the battery is less than 3/4 full and a charge is desired, then the robot will continue to home in on the IR beam until a physical connection to the charging station is detected, whereupon the system transitions to the ‘Charging’ state.
- In the Charging state, the system monitors the charging status signals, waiting for both ‘Fin1’ and ‘Fin2’ signals to become TRUE. When this happens, the robot backs out of the charging station lead-in gate area, executes a 90º turn away from the nearest wall, and transitions back to the ‘Wall-Following’ state.
Here is a first cut at a system software structure chart that incorporates the above modes/states