218C - ANSEL aTOMs

CVC State Machines 

The CVC calls three state machines in the main loop: (1) Transmit, (2) Receive, and (3) Check Inputs. The Transmit state machine is responsible for sending motor commands to the Xbee through EUART and to send updated team colors or captured atolls through EUART to a separate servo PIC dedicated to controlling these functions. The transmission of updated team colors or captured atoll statuses do not include many of the things needed to send through Xbee (such as delimiters and checksums), so only the servo PIC sees these messages. The Receive state machine is responsible for either setting team color or updating the status of captured atolls. The Check Inputs state machine maps the inputs to the left and right motor speeds in many states because we found that doing it one shot created approximately 2ms of blocking code, making us miss received data. 
Picture
Picture
Picture
Picture