Datasheet

Page 174ยท Applied Robotics with the SumoBot
LOOP
ELSEIF irRF = 1 THEN ' Just right?
counter = 0 ' State=track front right object
DO UNTIL (irLF = AND irRF = 1) OR counter > 15
maneuver = PivotRight ' Pivot right 15
GOSUB Servos_And_Sensors
counter = counter + 1
LOOP
ELSE ' No objects detected?
GOSUB Read_Object_Detectors ' State = search pattern
ENDIF
LOOP
Software that is used for designing and modeling state machines that go into automated
machinery and/or integrated circuits have various ways of both simplifying state
diagrams and at the same time making them more versatile. One of the techniques is
assigning priority to various conditions for transition from one state to another. That
way, the programmer (or the software that writes the program from the hybrid state
diagram) can decide in what order to examine each condition. It also simplifies the
conditions and reduces the number of transitions. Another common technique is to have
a node in the transition line that can branch to multiple states depending on multiple
conditions โ€“ โ€œconditional branch.โ€
Figure 4-11 shows an example of a hybrid state diagram that describes the
FrontIrNavigation.bs2's Main Routine. The "Next State" state is unconventional, as are
the numbers inside the Next State circle that show what order it evaluates the conditions
for transition. Even so, the figure describes what's happening in the main routine much
more succinctly than a normal state diagram.