top of page
Master State Machine

Header

Code

Navigating State Machine

Header

Code

Staging State Machine

Header

Code

Shooting State Machine

Header

Code

Master is the top level of the hierarchical state machine. It governs which of the substates (Navigating, Staging, Shooting, Reloading, and Back To Tape) the robot is in based on events posted.

Navigating is the substate machine that checks game status and decides if the robot should proceed to the next staging area or reload station depending on its current location and ball count.

Staging is the substate machine responsible for checking in at a designated staging area. In this module, the robot stops when a magnetic field is detected and reports the frequency detected. If the report response indicates it as an active staging area, the module proceeds to the second check-in attempt. If the report response indicates it as an inactive staging area, the module executes external self-transition and proceeds to the next staging area until it arrives at an active staging area. During Following Tape substate in the module, Tape bottom level state machine is active. â€‹

Shooting is the substate machine responsible for locating and shooting at an open goal. In this module, the robot queries open goal and moves to the staging area that corresponds to the open goal. It then moves forward to center itself at the staging area and starts rotating to look for an active goal. Once the goal is detected, it loads a ball into the flicker and shoots the ball at the goal. 3 seconds later, it checks if the shot is successful and either rotate back to the tape or repeat another shooting attempt.

Reloading State Machine

Reloading is the substate machine responsible for reloading balls at the supply depot. In this module, the robot follows the tape, through Tape bottom level state machine, towards the supply depot until the limit switch in the front bumper is triggered. It then pulses IR lights to request ball. After each ball request attempt, it detects if a ball is successfully reloaded and update ball count accordingly. The reloading is completely if ball count reaches 5 or request attempts reaches 7.

Header

Code

BackToTape State Machine

BackToTape is the substate machine responsible for navigating back to the tape if the robot is lost on the field. In this module, the robot rotates until it finds its supply depot IR Beacon. It then drives straight towards the depot until the limit switch in the front bumper is triggered, in which case the robot is back to the tape and can proceed to other substates.

Header

Code

Tape State Machine

Tape is the bottom level state machine responsible for deciding if a U-turn is needed based on current location, current direction and destination. In this module, the robot follows the tape until an external event happens and transitions to other substates.

Header

Code

Simple Services

8 simple services were developed to support the main hierarchical state machine. Events posted from/to the Master State Machine to/from the simple services and associated actions are listed in the following table. LEDIndicator service is not included in the table. It manages the construction in progress LED, team indicator LED, and ball request LED. 

Pseudo-Code

Header

Code

MotorDrive Service

Pseudo-Code

Header

Code

SPI Service
IRBeacon Service

Pseudo-Code

Header

Code

LaunchManager Service

Pseudo-Code

Header

Code

Flywheel Service

Pseudo-Code

Header

Code

LimitSwitch Service

Pseudo-Code

Header

Code

HallEffect Service

Pseudo-Code

Header

Code

LEDIndicator Service

Pseudo-Code

Header

Code

© 2017 by Stanford ME218b Team2

bottom of page