# team-roboto/h7_embedded_control_code architecture

> Architecture diagram of the GitHub repository team-roboto/h7_embedded_control_code, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/team-roboto/h7_embedded_control_code
- Repository: https://github.com/team-roboto/h7_embedded_control_code

## Overview

This is STM32H723 robot-control firmware for a DaMiao MC02 board. The documented workflow starts with remote input and sensor feedback, updates robot state, computes chassis, gimbal and shooting control, and communicates with actuators and a Jetson-class host. The graph also preserves referee/UI reporting and the internal algorithms and board-support layer. Task and peripheral wiring is based on the README and file tree; unsampled task implementations limit the edges shown.

Main entry points: [`Application/Task/Src/Control_Task.c`](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/Control_Task.c) (Control task), [`Components/Controller/Src/chassis_control.c`](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Controller/Src/chassis_control.c) (Chassis control), [`Application/Task/Src/UI_Task.c`](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/UI_Task.c) (HUD task), [`Application/Task/Src/USB_MiniPC_Task.c`](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/USB_MiniPC_Task.c) (USB host task)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime tasks"]
  node_control_task["Control task<br/>[Control_Task.c]"]
  node_can_task["CAN task<br/>[CAN_Task.c]"]
  node_ins_task["INS task<br/>[INS_Task.c]"]
  node_detect_task["Detection task<br/>[Detect_Task.c]"]
  node_ui_task["HUD task<br/>[UI_Task.c]"]
  node_usb_task["USB host task<br/>[USB_MiniPC_Task.c]"]
  node_chassis_task["Chassis task<br/>[Chassis_Task.c]"]
  node_gimbal_task["Gimbal task<br/>[Gimbal_Task.c]"]
  node_shoot_task["Shooting task<br/>[Shooting_Task.c]"]
end

subgraph group_control["Robot control"]
  node_state["State machine<br/>[state_machine.c]"]
  node_chassis["Chassis control<br/>[chassis_control.c]"]
  node_gimbal["Gimbal control<br/>[gimbal_control.c]"]
  node_shoot["Shooting control<br/>[shooting_control.c]"]
  node_power["Power estimation<br/>[power_estimation.c]"]
  node_algorithms["Control algorithms<br/>[PID.c]"]
end

subgraph group_devices["Devices and links"]
  node_remote["Remote control<br/>[Remote_Control.c]"]
  node_imu["IMU driver<br/>[Bmi088.c]"]
  node_motors["Motor drivers<br/>[Motor.c]"]
  node_referee["Referee interface<br/>[Referee_System.c]"]
  node_minipc["MiniPC protocol<br/>[MiniPC.c]"]
  node_image["Image transmission"]
end

subgraph group_platform["Platform support"]
  node_main["MCU startup<br/>[main.c]"]
  node_can_bsp["CAN board support<br/>[bsp_can.c]"]
  node_uart_bsp["UART board support<br/>[bsp_uart.c]"]
  node_usb_cdc["USB CDC<br/>[usbd_cdc_if.c]"]
  node_sensor_bsp["Sensor peripherals<br/>[bsp_spi.c]"]
end

node_host(("Jetson host"))
node_operator(("Remote operator"))

node_main -->|"starts scheduler"| node_control_task
node_operator -->|"sends input"| node_remote
node_remote -->|"provides commands"| node_control_task
node_sensor_bsp -->|"supports acquisition"| node_imu
node_imu -->|"provides measurements"| node_ins_task
node_control_task -->|"updates state"| node_state
node_control_task -->|"runs control"| node_chassis
node_control_task -->|"runs control"| node_gimbal
node_control_task -->|"runs control"| node_shoot
node_control_task -->|"estimates power"| node_power
node_chassis_task -->|"controls chassis"| node_chassis
node_gimbal_task -->|"controls gimbal"| node_gimbal
node_shoot_task -->|"controls shooting"| node_shoot
node_chassis -->|"uses PID"| node_algorithms
node_gimbal -->|"uses PID"| node_algorithms
node_shoot -->|"uses PID"| node_algorithms
node_can_task -->|"uses CAN"| node_can_bsp
node_can_bsp -->|"transfers frames"| node_motors
node_motors -->|"returns feedback"| node_can_bsp
node_ui_task -->|"reads status"| node_referee
node_ui_task -->|"reads controls"| node_remote
node_ui_task -->|"reads state"| node_chassis
node_host -->|"sends commands"| node_usb_task
node_usb_task -->|"uses CDC"| node_usb_cdc
node_usb_task -->|"handles protocol"| node_minipc
node_minipc -->|"uses UART"| node_uart_bsp
node_uart_bsp -.->|"exchanges telemetry"| node_host
node_host -.->|"sends commands"| node_minipc
node_detect_task -.->|"handles imagery"| node_image
node_image -.->|"transmits images"| node_host

click node_main "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Core/Src/main.c"
click node_control_task "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/Control_Task.c"
click node_can_task "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/CAN_Task.c"
click node_ins_task "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/INS_Task.c"
click node_detect_task "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/Detect_Task.c"
click node_ui_task "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/UI_Task.c"
click node_usb_task "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/USB_MiniPC_Task.c"
click node_chassis_task "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/Chassis_Task.c"
click node_gimbal_task "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/Gimbal_Task.c"
click node_shoot_task "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/Shooting_Task.c"
click node_state "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Controller/Src/state_machine.c"
click node_chassis "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Controller/Src/chassis_control.c"
click node_gimbal "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Controller/Src/gimbal_control.c"
click node_shoot "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Controller/Src/shooting_control.c"
click node_power "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Controller/Src/power_estimation.c"
click node_algorithms "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Algorithm/Src/PID.c"
click node_remote "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Device/Src/Remote_Control.c"
click node_imu "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Device/Src/Bmi088.c"
click node_motors "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Device/Src/Motor.c"
click node_referee "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Device/Src/Referee_System.c"
click node_minipc "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Device/Src/MiniPC.c"
click node_image "https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Device/Src/Image_Transmission.c"
click node_can_bsp "https://github.com/team-roboto/h7_embedded_control_code/blob/main/BSP/Src/bsp_can.c"
click node_uart_bsp "https://github.com/team-roboto/h7_embedded_control_code/blob/main/BSP/Src/bsp_uart.c"
click node_usb_cdc "https://github.com/team-roboto/h7_embedded_control_code/blob/main/USB_DEVICE/App/usbd_cdc_if.c"
click node_sensor_bsp "https://github.com/team-roboto/h7_embedded_control_code/blob/main/BSP/Src/bsp_spi.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_control_task,node_can_task,node_ins_task,node_detect_task,node_ui_task,node_usb_task,node_chassis_task,node_gimbal_task,node_shoot_task toneBlue
class node_state,node_chassis,node_gimbal,node_shoot,node_power,node_algorithms toneAmber
class node_remote,node_imu,node_motors,node_referee,node_minipc,node_image toneMint
class node_main,node_can_bsp,node_uart_bsp,node_usb_cdc,node_sensor_bsp toneRose
class node_host,node_operator toneIndigo
```

## Components

### Runtime tasks

- [Control task](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/Control_Task.c): `Application/Task/Src/Control_Task.c`
- [CAN task](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/CAN_Task.c): `Application/Task/Src/CAN_Task.c`
- [INS task](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/INS_Task.c): `Application/Task/Src/INS_Task.c`
- [Detection task](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/Detect_Task.c): `Application/Task/Src/Detect_Task.c`
- [HUD task](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/UI_Task.c): `Application/Task/Src/UI_Task.c`
- [USB host task](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/USB_MiniPC_Task.c): `Application/Task/Src/USB_MiniPC_Task.c`
- [Chassis task](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/Chassis_Task.c): `Application/Task/Src/Chassis_Task.c`
- [Gimbal task](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/Gimbal_Task.c): `Application/Task/Src/Gimbal_Task.c`
- [Shooting task](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Application/Task/Src/Shooting_Task.c): `Application/Task/Src/Shooting_Task.c`

### Robot control

- [State machine](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Controller/Src/state_machine.c): `Components/Controller/Src/state_machine.c`
- [Chassis control](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Controller/Src/chassis_control.c): `Components/Controller/Src/chassis_control.c`
- [Gimbal control](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Controller/Src/gimbal_control.c): `Components/Controller/Src/gimbal_control.c`
- [Shooting control](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Controller/Src/shooting_control.c): `Components/Controller/Src/shooting_control.c`
- [Power estimation](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Controller/Src/power_estimation.c): `Components/Controller/Src/power_estimation.c`
- [Control algorithms](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Algorithm/Src/PID.c): `Components/Algorithm/Src/PID.c`

### Devices and links

- [Remote control](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Device/Src/Remote_Control.c): `Components/Device/Src/Remote_Control.c`
- [IMU driver](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Device/Src/Bmi088.c): `Components/Device/Src/Bmi088.c`
- [Motor drivers](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Device/Src/Motor.c): `Components/Device/Src/Motor.c`
- [Referee interface](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Device/Src/Referee_System.c): `Components/Device/Src/Referee_System.c`
- [MiniPC protocol](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Device/Src/MiniPC.c): `Components/Device/Src/MiniPC.c`
- [Image transmission](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Components/Device/Src/Image_Transmission.c): `Components/Device/Src/Image_Transmission.c`

### Platform support

- [MCU startup](https://github.com/team-roboto/h7_embedded_control_code/blob/main/Core/Src/main.c): `Core/Src/main.c`
- [CAN board support](https://github.com/team-roboto/h7_embedded_control_code/blob/main/BSP/Src/bsp_can.c): `BSP/Src/bsp_can.c`
- [UART board support](https://github.com/team-roboto/h7_embedded_control_code/blob/main/BSP/Src/bsp_uart.c): `BSP/Src/bsp_uart.c`
- [USB CDC](https://github.com/team-roboto/h7_embedded_control_code/blob/main/USB_DEVICE/App/usbd_cdc_if.c): `USB_DEVICE/App/usbd_cdc_if.c`
- [Sensor peripherals](https://github.com/team-roboto/h7_embedded_control_code/blob/main/BSP/Src/bsp_spi.c): `BSP/Src/bsp_spi.c`

### Other components

- **Jetson host**
- **Remote operator**

## Connections

- MCU startup → Control task: starts scheduler
- Remote operator → Remote control: sends input
- Remote control → Control task: provides commands
- Sensor peripherals → IMU driver: supports acquisition
- IMU driver → INS task: provides measurements
- Control task → State machine: updates state
- Control task → Chassis control: runs control
- Control task → Gimbal control: runs control
- Control task → Shooting control: runs control
- Control task → Power estimation: estimates power
- Chassis task → Chassis control: controls chassis
- Gimbal task → Gimbal control: controls gimbal
- Shooting task → Shooting control: controls shooting
- Chassis control → Control algorithms: uses PID
- Gimbal control → Control algorithms: uses PID
- Shooting control → Control algorithms: uses PID
- CAN task → CAN board support: uses CAN
- CAN board support → Motor drivers: transfers frames
- Motor drivers → CAN board support: returns feedback
- HUD task → Referee interface: reads status
- HUD task → Remote control: reads controls
- HUD task → Chassis control: reads state
- Jetson host → USB host task: sends commands
- USB host task → USB CDC: uses CDC
- USB host task → MiniPC protocol: handles protocol
- MiniPC protocol → UART board support: uses UART
- UART board support → Jetson host: exchanges telemetry
- Jetson host → MiniPC protocol: sends commands
- Detection task → Image transmission: handles imagery
- Image transmission → Jetson host: transmits images
