Professional Documents
Culture Documents
CurrentState is Aligning
Set ReturnEvent equal to CurrentEvent equal to return of
DuringAligning()
If CurrentEvent.EventType is not equal to ES_NO_EVENT
ThisEvent is AR1_ALIGN
Start KICKBACK_TIMER
Post DRIVE_STOP to MotorService
Set MakeTransition equal to false
ThisEvent is NOT_ALIGNED
If CheckLimit is false
Post ES_ALIGN_QUERY to SPILeaderService
EndIf
Else
Post ES_LIMIT_QUERY to SPILeaderService
EndElse
ThisEvent is LIMIT_PRESS
If EventParam is LIMIT_PRESS
Set NextState equal to Exiting
Set MakeTransition to true
EndIf
Else
Post ES_LIMIT_QUERY to SPILeaderService
EndElse
ThisEvent is ES_TIMEOUT
If EventParam is KICKBACK_TIMER
Set NextState equal to Exiting
Set MakeTransition to true
EndIf
Else if EventParam is STARTING_TIMER
Set CheckLImit equal to true
EndElse
EndIf
End Aligning block
CurrentState is Exiting
Set ReturnEvent equal to CurrentEvent equal to return of
DuringExiting()
If CurrentEvent.EventType is not equal to ES_NO_EVENT
ThisEvent is ES_TIMEOUT
Set NextState equal to WaitingInStarting
Set MakeTransition equal to true
EndIf
End Exiting block
Return ReturnEvent
End of RunStartingSM
StartStartingSM
Takes CurrentEvent as parameter, returns nothing.
End of StartStartingSM
DuringAligning
Takes Event as parameter, returns Event.
If Event is ES_ENTRY
Post DRIVE_RIGHT_REVERSE to MotorService
Post DRIVE_LEFT_REVERSE to MotorService
Post ES_ALIGN_QUERY to SPILeaderService
Start STARTING_TIMER
Set CheckLimit equal to false
Endif
Endif
Else
EndElse
Return Event
End of DuringAligning
DuringExiting
Takes Event as parameter, returns Event.
If Event is ES_ENTRY
Post DRIVE_LEFT_FORWARD to MotorService
Post DRIVE_RIGHT_FORWARD to MotorService
Start STARTING_TIMER
Endif
Else
Set Event equal to return of call to RunStartingSM with
parameter Event
EndElse
Return Event
End of DuringExiting