Download Applied Robotics with the SumoBot Text
Transcript
Page 184· Applied Robotics with the SumoBot Figure 4-13 Sample SumoBot Search Pattern This one is different because the SumoBot looks around before it starts going forward. There are a couple of different ways to get the SumoBot to do this maneuver. The first is to write a custom Initialization routine that performs this maneuver before moving on to the Main Routine. Here's another way. √ √ Save SearchPatternAndAvoidTawara.bs2 as a new file with YourTurn.bs2 appended to the name Add the Look_About: label to the search pattern code. It's commented with ' <--- Add Starting point in the search pattern routine below. ELSE FOR counter = 1 TO 35 maneuver = Forward GOSUB Servos_And_Sensors IF sensors <> 0 THEN GOTO Next_State NEXT Look_About: FOR counter = 1 TO 12 maneuver = RotateRight GOSUB Servos_And_Sensors IF sensors <> 0 THEN GOTO Next_State NEXT . . . ENDIF ' No objects detected? ' State = search pattern ' Forward ' <--- Add Starting point label ' Look right