Skip to content

Latest commit

 

History

History
38 lines (23 loc) · 1.28 KB

CopernicOS.md

File metadata and controls

38 lines (23 loc) · 1.28 KB

CopernicOS

The goal of this script is to manage low-level IO for an autonomous vehicle, including CAN communication, safety checks, and interfaces with the vehicle's stock control module.

All of this should be done in real time. This means that every request should be attended to and completed within a guaranteed maximum delay.

To accomplish this, all tasks should be identified and evaluated in a main loop. External events should be read in (such as from the high-level onboard computer, the GNSS sensor, the CAN linear actuator, etc). This loop should read new events, evaluate them, print the results as necessary to the onboard computer, and loop to the beginning. This architecture is called a REPL.

Main loop

while True:
    # Read
    readSerialMessages()
    readBrakeMessages() # Check for error states etc
    readGnssMessages() # In the  future
    
    # Evaluate
    runBrakeCommand()
    runThrottleCommand()
    
    # Print
    sendAck() # Send an acknowledgment to the OBC with summary of actions

Serial command protocol

The general format is:

$[SEQ],[VERB],[PARAMS]\n

Of course, \n is a newline control character. For the sake of simplicity, \n will be assumed in the rest of this document.

Throttle

$1,THROTTLE,0.42\n