The XBeeCommFSM Flat State Machine (FSM) controls the main functionality of the BOSYN. It handles transmitting data, receiving data, and posting appropriate events to the peripherals. XBeeCommFSM only has 2 states: Unpaired and Paired. The only way to exit the Unpaired state is to receive a valid pair acknowledgement from the targeted BOAT. There are 3 ways to exit the Paired state: the inactivity timeout, the user manually unpairs, or the BOAT sends an unpair command.
The Servo Service handles the biting servo on the BOSYN. It raises for 2 seconds after a successful bite.
The Peripheral Service is responsible for the paired LED and audio. It gets events from XBeeCommFSM and responds appropriately.
BOAT Code
The XBeeCommSM Flat State Machine (FSM) controls the main functionality of the BOAT. It handles transmitting data, receiving data, and posting appropriate events to the peripherals. XBeeCommFSM only has 2 states: WaitingForPairing and Paired. The only way to exit the WaitingForPairing state is to receive a valid pair request from a BOAT. There are 3 ways to exit the Paired state: the inactivity timeout, the BAYT deflates, or the BOSYN sends an unpair command.
The Servo Service handles the biting servo on the BOSYN. It raises for 2 seconds after a successful bite.
The Servo Service handles the biting and paired indicator. When given the ES_BITE event, this service activates the byter. It also primes the byter for the next attack when given the ES_PRIME_BYTER event from the BYTER SM.
The Motor Service controls the right and left motors on the BOAT. It gets ES_MOTOR_CMD events whose parameters are the thrust and yaw from the XBeeComm FSM. This service converts these thrust and yaw commands into PWM and direction values.