Software Design
We made a three level hierarchical state machine called Master SM (state machine) that works in conjunction with a two level state machine called Comm.
Comm deals with the SPI transmits between our LOC and the construction manager - it both sends commands and reads and parses the responses that the LOC receives.
MasterSM consists of two main states: waiting for the game start and constructing (playing a game). Constructing SM is the second level of the state chart, implementing the higher-level logic of how we move through gameplay (from driving to shooting, to checking in and reloading). The lower level SMs, shooting, loading, driving, and checkin, contain the logic behind controlling these individual subsystems. For example, the shooting state machine involves the following states: aligning to the beacon, ramping up the flywheel, shooting the ball, and then checking whether we made it.
We also have Helper Modules, which implement the lower level functions behind the different components. This includes implementing PWM, different sensors and circuits, interrupts, and closed loop control on the motors. Finally, we have modules that contain the coding "logistics" that make sure that no pin or interrupt is used twice, and no constants are rewritten across services.
Comm deals with the SPI transmits between our LOC and the construction manager - it both sends commands and reads and parses the responses that the LOC receives.
MasterSM consists of two main states: waiting for the game start and constructing (playing a game). Constructing SM is the second level of the state chart, implementing the higher-level logic of how we move through gameplay (from driving to shooting, to checking in and reloading). The lower level SMs, shooting, loading, driving, and checkin, contain the logic behind controlling these individual subsystems. For example, the shooting state machine involves the following states: aligning to the beacon, ramping up the flywheel, shooting the ball, and then checking whether we made it.
We also have Helper Modules, which implement the lower level functions behind the different components. This includes implementing PWM, different sensors and circuits, interrupts, and closed loop control on the motors. Finally, we have modules that contain the coding "logistics" that make sure that no pin or interrupt is used twice, and no constants are rewritten across services.
State Chart
Software Files
Game Play Service
MasterSM [PseudoCode] [MasterSM.h] [MasterSM.c] ConstructingSM [PseudoCode] [ConstructingSM.h] [ConstructingSM.c] DrivingSM [PseudoCode] [DrivingSM.h] [DrivingSM.c] CheckinSM [PseudoCode] [CheckinSM.h] [CheckinSM.c] ShootingSM [PseudoCode] [ShootingSM.h] [ShootingSM.c] LoadingSM [PseudoCode] [LoadingSM.h] [LoadingSM.c] |
Communications Service
CommMasterHSM [PseudoCode] [CommMasterHSM.h] [CommMasterHSM.c] GameChatHSM [PseudoCode] [GameChatHSM.h] [GameChatHSM.c] Software Logistics ES_Configure [ES_Configure.h] Hardware [PseudoCode] [Hardware.h] [Hardware.c] Constants [Constants.h] |
Helper Modules
PWM [PseudoCode] [PWM.h] [PWM.c] Hall_Effect [PseudoCode] [Hall_Effect_Module.h] [Hall_Effect_Module.c] Driving Control [PseudoCode] [Drive_Motor_Speed_Control_Module.h] [Drive_Motor_Speed_Control_Module.c] Servo [PseudoCode] [Servo_Module.h] [Servo_Module.c] Ultrasonic_Sensor [PseudoCode] [Ultrasonic_Module.h] [Ultrasonic_Module.c] Beacon [PseudoCode] [Beacon_Module.h] [Beacon_Module.c] |