You are on page 1of 1

RunUnloadingSM

switch Current State


case GoToBeacon
CurrentEvent=DuringGoToBeacon
If Current Event is ES_OPPONENTBEACONDETECTED, make Next State to GetTape, perform Exit function for
current state and entry function for next state

case GetTape
CurrentEvent=DuringGetTape
If Current Event is ES_TAPE, make Next State to GoToRecyling, perform Exit function for current state and entry
function for next state

case GoToRecycling
CurrentEvent=DuringGTR
If Current Event is ES_BACKCRASH, make Next State to ActivateRecycling, perform Exit function for current state
and entry function for next state

case ActivateRecycling
CurrentEvent=DuringActivateRecycling
If Current Event is ES_TIMEOUT, make Next State to OpenGate, perform Exit function for current state and entry
function for next state

case OpenGate
CurrentEvent=DuringOpenGate
If Current Event is ES_TIMEOUT, make Next State to CloseGate, perform Exit function for current state and entry
function for next state

case CloseGate
CurrentEvent=DuringCloseGate
Set CurrentState to GoToBeacon, and initialize timer. Make Transition to false to not perform entry and exit
functions

StartUnloadSM
CurrentState to be made as GoToBeacon
RunUnloadingSM to be run with CurrentEvent

DuringGoToBeacon
Post Get beacon to motor with opponent beacon value as entry function

DuringGetTape
Post Move forward to motor as entry function

DuringGoToRecycling
As an Entry function, check the side of recycling center and post corresponding direction to motor with activation
frequency being set to IR

DuringActivateRecycling
Move the motor slightly forward to prevent clashing with the walls, Set Frequency on IR as Entry function and trigger a
timer

DuringOpenGate
Open Servo and trigger timer as Entry function

DuringCloseGate
Close Servo as Entry Function

You might also like