For a more detailed look at the full C implementation, please refer to our Github repository.Â
TopLevelHSM: Top level HSM for game start, game reset, timeout, and orientation.
GameHSM: Hierarchical state machine for the flow of the gameplay.
DriveToDispenserFSM: State machine that controls the robot as it follows the line to the ball dispenser and collects coal.
DispenserToBucketFSM: State machine that controls the robot as it follows the line from the dispenser to the first bucket and dispense the coal.
TapeToBeaconFSM: State machine that controls the robot as it drives to the second bucket (by aligning with the beacon) and dispenses the coal.
BeaconToTapeFSM: State machine that controls the robot as it drives from the second bucket to the third bucket (by detecting tape) and dispenses the coal.
TapeToDispenserFSM: State machine  that controls the robot as it drives from the third bucket back to the coal dispenser (with line following) and collects coal again.
SPILeaderService: Handles communication between leader and follower PICs, sends commands to the buffer and handles querying the follower periodically.
OrientService: Align with beacon and decide the side of robot.
ServoService: Handles servo movement and DC output.
EventCheckers:Â Detects start button and limit switch status.
PIC32_SPI_HAL:Â Abstraction layer for all low level SPI communication.
PWM_PIC32: Helper functions for pulsewidth modulation.
SPIFollowerService: Handles communication between leader and follower PICs, receives commands over SPI and sends events to the MotorSM to respond accordingly.Â
MotorSM: State machine that handles wheel motor control with sensor readings for line following.
 BeaconService: Detects beacon with different frequencies and posts events when beacon detections occur.
EncoderService: Uses encoder input capture signals for line following and speed/position control logic.
The Top Level Hierarchical State Machine is responsible for getting Purple Tape oriented and starting the GameHSM.
The Game Hierarchical State Machine is responsible for running our team's strategy for gameplay.
The DriveToDispenser FSM is responsible for getting Purple Tape from the starting point to the coal dispenser, and then intaking and processing coal.
The DispenserToBucket FSM is responsible for getting Purple Tape from the coal dispenser to the first bucket using tape following and filling this bucket.
The TapeToBeacon FSM is responsible for getting Purple Tape from the first bucket to the second beacon using the beacon and filling this bucket. However, this FSM was ultimately excluded due to time constraints and replaced with BeaconToTape.
The BeaconToTape FSM is responsible for getting Purple Tape from the second bucket to the third using tape and filling this bucket. However, due to time constraints, we directly entered this sequence after filling the first bucket.
The TapeToDispenser FSM is responsible for getting Purple Tape from the third bucket back to the dispenser to refill coal.
SPI Leader Service is responsible for communication between the leader PIC and follower PIC using SPI.
Event Checkers included event checking functions such as start button being pressed or the limit switch being triggered.
Orientation Service is responsible for indication of game orientation after the start button is pressed and a beacon is detected.
Servo Service is responsible for control of all servos such as the containter, arm, and side indicator, as well as the coal processing DC motors.
SPI HAL is utitlized for facilitating SPI communication.
The PWM library contains functions for PWM control used by servos and DCmotors.
Motor SM is responsible for drivetrain motor RPM control using encoder feedback and line following using basic PI control.
Beacon Service is responsible for detecting IR beacons found on the field using conditioned phototransistor signals.
Encoder Service is responsible for processing interrupts produced by magnetic encoder pulses from the drivetrain motor rotation.
SPI Follower Service is responsible for communication between the follower PIC and leader PIC using SPI.