Академический Документы
Профессиональный Документы
Культура Документы
This High level state machine should replicate what is in our state chart power
point
Most states have only one exit transition they can make, with the exception of d
riving.
It also occurs to me that we can get rid of the pre game state entirely and just
enter
into the Waiting4Instruction state upon start-up but I want to speak to the othe
rs about
that first.
Date of Creation_171602
Based upon StateChart_171502
InitHighLevelStateMachine
ES_Event ThisEvent;
MyPriority = Priority; // save our priority
ThisEvent.EventType = ES_ENTRY;
// Start the Master State machine
StartHighLevelStateMachine( ThisEvent)
RunHighLevelStateMachine(Es Event)
return event = no event
switch case
case Driving State
Execute During function for state. ES_ENTRY & ES_EXIT ar
e
processed here allow the lower level state machines to re-map
or consume the event
CurrentEvent = DuringDriving(CurrentEvent)
process any events.
if event is active != No event
switch case
CurrentEvent = ES_AtStagingArea
if param = (1)Staging area 1
make a transition to the staging
area report state
if param = (2)Staging area 2
make a transition to the staging
area report state
if param = (3)Staging area 3
make a transition to the staging
area report state
CurrentEvent = ES_AtDepotOrientation
make a transition to the getting
cows
CurrentEvent = ES_AtShootingOrientation
make a transition to the shootin
g cows
break
break
case GettingCows
Execute During function for state. ES_ENTRY & ES_EXIT are
processed here allow the lower level state machines to re-map
or consume the event
CurrentEvent = DuringGettingCows(CurrentEvent)
process any events.
if event is active != No event
switch case
CurrentEvent=Full_of_Balls
transition to driving
break
break
case ShootingCows
Execute During function for state. ES_ENTRY & ES_EXIT ar
e
processed here allow the lower level state machines to re-map
or consume the event
CurrentEvent = DuringShootingCows(CurrentEvent)
process any events.
if event is active != No event
switch case
if event=ES_OutOfBalls
post to LOC brain that we are out
next state = Driving
mark transition as true
break
break
case IdentifyingStaging
Execute During function for state. ES_ENTRY & ES_EXIT ar
e
processed here allow the lowere level state machines to re-map
or consume the event
CurrentEvent = DuringIdentifyingStaging(CurrentEvent)
process any events.
if event is active != No event
switch case
mark transition as true
break
break
------------------StateTransition-----------------------------
If we are making a state transition{}
Execute exit function for current state
Current Event Type = ES_EXIT;
RunTemplateSM(CurrentEvent);
CurrentState = NextState Modify state variable
Execute entry function for new state this defaults to ES
_ENTRY
RunTemplateSM(EntryEventKind)
}
in the absence of an error the top level state machine should
always return ES_NO_EVENT, which we initialized at the top of this funct
ion
return(ReturnEvent)
end RunHighLevelStateMachine
DuringDriving (Driving)
on Entry
StartDrivingSM(Entry)
on Exit
RunDrivingSM(exit) //let lower level clean up
else
RunDrivingSM(event) //events make it down;
return event
end