Control Flow: Final Plan


This page describes our second (and final) plan for control flow. Click here to see our Original Plan for control flow and why it didn't work. In most ways, the final plan is very similar to the original, with the notable exception of a third cricket. Cricket 1 performed the same basic functions as the hallway cricket in the original plan, while Cricket 2 performed the same basic functions as the room cricket. Cricket 3, the new one, continually checked the floor for white lines (indicating that the robot was in a room or within 12" of the candle) and managed the control flow between Crickets 1 and 2. Crickets communicate with each other by using IR signals; these signals were used to pass control back and forth.

At the highest level, the problem was split into two separate modes, hallway mode and room mode, as in the original plan. Cricket 1 held primary control while in hallway mode and Cricket 2 held primary control while in room mode. When the robot came to a doorway (indicated by a white line on the floor), Cricket 3 sent a signal to the other two crickets for Cricket 1 to relinquish control and for Cricket 2 to take control. If Cricket 2 determined that there was no candle in the room, Cricket 3 directed the return of control to Cricket 1.

If you are interested in a more detailed description of the algorithms that we used, click on the following links:

 

Hallway Mode

The function of Cricket 1 was to navigate through the maze. By reading the sensor values and controlling the wheel motors, it was able to direct the robot to follow a wall and make turns. Connected to it were the two wheel motors, the two left-side bathroom sensors, two right-side bathroom sensors and the front bathroom sensor. Additionally, it had one IR sensor that was used in the shaft-encoding.

The robot started by following the wall with Cricket 1 in control. When it sensed a break in the wall, indicating a doorway or another branch of the hallway, it determined which of these was the case. It then took appropriate action (turning or going forward). If, after executing this action, it received a signal from Cricket 3 that the robot had entered a room, it passed control to Cricket 2. If it did not receive this signal, or when Cricket 2 returned control, it continued to follow the wall.

If you are interested in the specifics of the algorithms we used, take a look at the Cricket 1 page (in English) or the Cricket 1 code (in CricketLogo).

 

Room Mode

The function of Cricket 2 was to find and extinguish the candle once in a room. Connected to it were two candle sensors and the motor for the pushing mechanism. The two candle sensors were placed to the right and left of the shaving cream can, facing forward. By reading sensor values and signaling Cricket 1 to control the wheels, Cricket 2 directed the robot toward the candle and then extinguished the flame. Cricket 3 continued to check the bottom IR sensor for a white line (indicating that the robot was within 12" of the candle) and signaled Cricket 2 when it crossed that line.

When control was first passed to Cricket 2, it determined whether or not there was a candle in that room by evaluating the candle sensor readings. If there was no candle, it backed the robot out of the room and passed control back to Cricket 1. If there was a candle, Cricket 2 directed the robot toward the candle by sending signals to Cricket 1 to manipulate the wheels. It determined the desired direction by comparing the values of the two candle sensors. The robot zig-zagged toward the candle, keeping the sensor readings relatively equal.

Once within range of the candle, Cricket 2 turned its motor on to start the pushing mechanism and dispense the shaving cream. It ran for certain amount of time, determined by experimentation to be sufficient for extinguishing the flame. It then reversed the direction of the motor to retract the gear rack and again ran the motor for a specified time. The robot had now completed its task.

If you are interested in the specifics of the algorithms we used, take a look at the Cricket 2 page (in English) or the Cricket 2 code (in CricketLogo).

 

 

 

Robot Home  Introduction  Final Robot  Structural Design  Navigational Systems  Misadventures