Communication
We only used Teensy 4.1 as a microcontroller, so we took advantage of the UART Ports for serial communication. Our pipeline for the Striker Flor follows this structure:

Since the Goalkeeper Capullo only contained one OpenMV H7, the pipeline simplifies to the following structure:

Observe that the OpenMV H7 (mirror) sends a data package containing the following variables to Teensy 4.1
Othersides, the front OpenMV H7 (front) sends a smaller package focused only on ball detection
Othersides, the front OpenMV H7 (front) sends a smaller package focused only on ball detection
Note that OpenMV H7 (front) utilizes the UART port corresponding to Serial1, so OpenMV H7 (mirror) was assigned to function through Serial2.
To process the whole data sent by the OpenMV H7 (mirror) the Teensy 4.1 follows these steps to transform the buffer array to changing variables.
- Read characters from Serial2 until a newline \n is found
- Store the received characters in a string serial2_line
- When a full line is received, call processSerial2(line)
- In processSerial2():
- Parse six float values:
ball_distance,ball_angle,goal_angle,own_distance,own_angle - Assign values to their respective variable
- Set flags:
open_ball_seenif ball distance and angle are non-zerogoal_seenif goal distance or angle is non-zero
- Parse six float values:
To process the smaller data buffer from OpenMV H7 (front) the Teensy 4.1 follows this similar steps.
- Read characters from Serial1 until a newline \n is found
- Store the received characters in a string serial1_line
- When a full line is received, call processSerial1(line)
- In processSerial1():
- Parse two float values from the line:
ball_distanceandball_angle - Assign values to
dribbler_distanceanddribbler_angle - Set flags:
dribbler_ball_seenif distance or angle is non-zeroball_capturedif distance ≤ 30 and angle is 0
- Parse two float values from the line: