STM32-Jetson Comms Implementation

Overview

Here we want to define what a communication system between the STM32 and Jetson need to exchange (refer to the Exchanged Data specifications from last year), when it will be communicated (event-driven vs. batch) and the overall data schema.

Requirements

Comm Subsystem Requirement

Competition Requirement

Priority

Comm Subsystem Requirement

Competition Requirement

Priority

Send the lattitude and longtitude in decimal degrees to the flight controller after a successful QR scan as well a begin takeoff command

Task 2: Send coordinates after QR Scan

high

At a specified rate, send the IMU and GPS data to the jetson

Task 2: Receive IMU data

high

At a specified rate, send the current location of the detected target to the flight controller

Task 2: Track targets

Low

Schema

Flight Controller → Jetson (FOJI)

// Format schema here as JSON { gpsCoordinates: { lattitude: 8 byte double, longtitude: 8 byte double, altitude: 8 byte double }, eulerAnglesOfPlane (Radians): { yaw: 4 byte float, pitch: 4 byte float, roll: 4 byte float } }
  • Note that in this iteration, eulerAnglesOfCamera comes from the gimbal controller rather than the flight controller.

Jetson → Firmware Controller (FIJO)

{ takeoffCommand: 1 byte boolean, qrScanFlag: 1 byte boolean, detectFlag: 1 byte boolean, gpsCoordinates: { lattitude: 8 byte double, longtitude: 8 byte double } }

Flags

These flags are booleans that are mutually excusive.

  • qrScanFlag: If true, then the gpsCoordinates are the coordinates that we got from the QR Scan.

  • detectFlag: If true, then the gpsCoordinates are the coordinates of the detected target. (used for hover mode)

Encoding

Encode the schema as a byte array. Note that the semicolons are just for readability, they're not part of the message.

FOJI

Start bit is a $ followed by FOJI

$FOJI;lattitude;longtitude;altitude;yaw;pitch;roll

Total Message Size: 41 bytes

FIJO

Start messages with a '$' sign followed by the string “FIJO”

Total message size: 24 bytes

Implementation - Computer Vision

FOJI Reception:

All functionality for FOJI is contained in the FltConnReceive module. The worker function will contain a blocking call to the read method of the UARTInterface in a loop. When a message is received, it will be passed into readFOJI to be decoded from a the FOJI encoding defined above into a response object of type “STATE_INFO” defined here. After decoded, it will be put into the pipeline out before a blocking call is made again to read the next message.

FIJO send:

 

All functionality relating to FIJO will be contained in the FltConnSend module. When a request is recieved of type QR_COORDINATES or TARGET_COORDINATES as defined here from the input pipeline in the worker function it will call the sendFIJO method to encode it into a string as defined above and set the required flags. The worker function will then use the write method of the UARTInterface to send the message before waiting for the next message from the pipeline.

Timeline/Plan:

  1. Understand how to create a general UART communication link between 2 microcontrollers - December 10th at the latest (the second I find some free time, won't take too long)

  2. Create a UART Driver to get ZeroPilot to send and receive data taking into account all the required information above - Maybe before exams?

  3. Test and integrate into Telemetry Manager - Sometime after exams, potentially winter break?

  4. Modify Telemetry and Path Manager Comms as required - Sometime after exams, potentially winter break?