Goals
Read POGI data from STM32 to Jetson for use by the CV system
Send PIGO data from Jetson to STM32 for use by autopilot
Read ground data from STM32 to send to ground
Send data from ground to STM32
Principles
Flexible data scheme at the interface layer, schema is defined at the FltConnRecieve/FltConnSend modules.
Communication protocol is implemented at the interface layer, therefore any logic that can change depending on the protocol used should be isolated at the interface. Note, the Endpoint concept is shared between a USB implementation (using a strict endpoint) and the UART implementation (just a serial port).
Interface Logic
All the interface logic will be isolated in a class called USBInterface/UARTInterface. The class is described below.
USBInterface/UARTInterface |
---|
+read(endpointId): Issues a read command in either serial (UART) or pyusb (USB). EndpointId can be the specific serial port to use or the usb endpoint to be used. +write(endpointId, data): Issues a write command in either serial or pyusb. Data parameter should be a buffer. +create_endpoint_FC(): Returns a new endpoint, either a Serial object (UART) or Endpoint object (USB), that points to our flightcontroller. |
-endpoints: Dictionary {endpointId: endpoint object (Serial object or Endpoint object)}. The first one is populated by calling the create_endpoint_FC() function in the constructor. |
TODO: Data logic in FltConn module
Perform any data processing required to turn the return of read(…) or write(…) into the appropriate python object. Implemented as a set of functions in the FltConn modules. PIGOs and POGIs are constructed at this stage.
TODO: API logic in FltConn module
Exposes functionality to the worker function. Should just have get_pogi() and get_pigo() functions.
Reference
PyUSB implementation overview (see here for what the Endpoint object is etc.)
https://pyserial.readthedocs.io/en/latest/pyserial.html#overview