# vq-vinh/da2-robot-agv architecture

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

- Interactive diagram: https://gitdiagram.com/vq-vinh/da2-robot-agv
- Repository: https://github.com/vq-vinh/da2-robot-agv

## Overview

DA2 is a Kiva-style warehouse AGV: an operator creates and confirms prioritized shelf-delivery orders; mission logic coordinates shelf approach, lift operations, delivery, return-to-slot, and charging. ROS 2 provides navigation, localization, perception, and simulation, while STM32 firmware implements motor-speed control. The README documents key flows and capabilities; sampled source confirms the mission entry points and embedded control calls. The Pi-to-MCU UART bridge is described as future work, so no implemented connection is asserted.

Main entry points: [`RasPi/src/agv_navigation/launch/navigation.launch.py`](https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_navigation/launch/navigation.launch.py) (Nav2 navigation), [`STM32/App/Src/app.c`](https://github.com/vq-vinh/da2-robot-agv/blob/main/STM32/App/Src/app.c) (Firmware app tasks), [`RasPi/src/agv_gazebo/launch/sim.launch.py`](https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_gazebo/launch/sim.launch.py) (Gazebo simulation), [`STM32/App/Src/speed_ctrl.c`](https://github.com/vq-vinh/da2-robot-agv/blob/main/STM32/App/Src/speed_ctrl.c) (Speed control)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mission["Orders and mission"]
  node_dashboard["Web dashboard<br/>[web_dashboard.py]"]
  node_order["Order manager<br/>[order_manager.py]"]
  node_mission_launch["Mission launch<br/>[mission.launch.py]"]
end

subgraph group_ros["ROS navigation"]
  node_nav2["Nav2 navigation"]
  node_perception["Shelf detection<br/>[shelf_detector.py]"]
  node_payload["Payload handling<br/>[payload_manager.py]"]
  node_localization["Localization and EKF<br/>[ekf.launch.py]"]
  node_slam["SLAM<br/>[slam.launch.py]"]
  node_description["Robot description<br/>[display.launch.py]"]
end

subgraph group_sim["Simulation"]
  node_simulation["Gazebo simulation<br/>[sim.launch.py]"]
  node_warehouse["Warehouse generation<br/>[make_warehouse.py]"]
end

subgraph group_firmware["STM32 firmware"]
  node_mcu_app["Firmware app tasks<br/>[app.c]"]
  node_speed["Speed control<br/>[speed_ctrl.c]"]
  node_motor["Motor driver<br/>[motor.c]"]
  node_encoder["Encoder driver<br/>[encoder.c]"]
  node_uart["UART transport<br/>[uart_tx.c]"]
end

subgraph group_tools["Control tools"]
  node_tuning["Live tuning<br/>[tune.py]"]
  node_plot["Speed log analysis<br/>[plot_speed.py]"]
end

node_operator(("Operator"))

node_operator -->|"submits orders"| node_dashboard
node_dashboard -->|"serves requests"| node_order
node_mission_launch -->|"starts mission"| node_order
node_order -->|"dispatches goals"| node_nav2
node_nav2 -->|"uses pose"| node_localization
node_perception -->|"provides shelf pose"| node_nav2
node_payload -->|"filters scans"| node_nav2
node_slam -.->|"provides mapping"| node_nav2
node_simulation -.->|"uses generated world"| node_warehouse
node_simulation -.->|"loads robot model"| node_description
node_simulation -->|"runs navigation"| node_nav2
node_nav2 -.->|"planned command link"| node_mcu_app
node_mcu_app -->|"runs control"| node_speed
node_mcu_app -->|"samples encoder"| node_encoder
node_mcu_app -->|"sends log data"| node_uart
node_speed -->|"sets motor output"| node_motor
node_speed -->|"reads speed"| node_encoder
node_tuning -->|"sends UART commands"| node_mcu_app
node_uart -.->|"streams telemetry"| node_tuning
node_tuning -.->|"records logs"| node_plot

click node_dashboard "https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_mission/scripts/web_dashboard.py"
click node_order "https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_mission/scripts/order_manager.py"
click node_mission_launch "https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_mission/launch/mission.launch.py"
click node_nav2 "https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_navigation/launch/navigation.launch.py"
click node_perception "https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_navigation/scripts/shelf_detector.py"
click node_payload "https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_navigation/scripts/payload_manager.py"
click node_localization "https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_localization/launch/ekf.launch.py"
click node_slam "https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_navigation/launch/slam.launch.py"
click node_description "https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_description/launch/display.launch.py"
click node_simulation "https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_gazebo/launch/sim.launch.py"
click node_warehouse "https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_gazebo/scripts/make_warehouse.py"
click node_mcu_app "https://github.com/vq-vinh/da2-robot-agv/blob/main/STM32/App/Src/app.c"
click node_speed "https://github.com/vq-vinh/da2-robot-agv/blob/main/STM32/App/Src/speed_ctrl.c"
click node_motor "https://github.com/vq-vinh/da2-robot-agv/blob/main/STM32/Modules/Src/motor.c"
click node_encoder "https://github.com/vq-vinh/da2-robot-agv/blob/main/STM32/Modules/Src/encoder.c"
click node_uart "https://github.com/vq-vinh/da2-robot-agv/blob/main/STM32/Modules/Src/uart_tx.c"
click node_tuning "https://github.com/vq-vinh/da2-robot-agv/blob/main/STM32/tools/tune.py"
click node_plot "https://github.com/vq-vinh/da2-robot-agv/blob/main/STM32/tools/plot_speed.py"

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_dashboard,node_order,node_mission_launch toneBlue
class node_nav2,node_perception,node_payload,node_localization,node_slam,node_description toneAmber
class node_simulation,node_warehouse toneMint
class node_mcu_app,node_speed,node_motor,node_encoder,node_uart toneRose
class node_tuning,node_plot,node_operator toneIndigo
```

## Components

### Orders and mission

- [Web dashboard](https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_mission/scripts/web_dashboard.py): `RasPi/src/agv_mission/scripts/web_dashboard.py`
- [Order manager](https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_mission/scripts/order_manager.py): `RasPi/src/agv_mission/scripts/order_manager.py`
- [Mission launch](https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_mission/launch/mission.launch.py): `RasPi/src/agv_mission/launch/mission.launch.py`

### ROS navigation

- [Nav2 navigation](https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_navigation/launch/navigation.launch.py): `RasPi/src/agv_navigation/launch/navigation.launch.py`
- [Shelf detection](https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_navigation/scripts/shelf_detector.py): `RasPi/src/agv_navigation/scripts/shelf_detector.py`
- [Payload handling](https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_navigation/scripts/payload_manager.py): `RasPi/src/agv_navigation/scripts/payload_manager.py`
- [Localization and EKF](https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_localization/launch/ekf.launch.py): `RasPi/src/agv_localization/launch/ekf.launch.py`
- [SLAM](https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_navigation/launch/slam.launch.py): `RasPi/src/agv_navigation/launch/slam.launch.py`
- [Robot description](https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_description/launch/display.launch.py): `RasPi/src/agv_description/launch/display.launch.py`

### Simulation

- [Gazebo simulation](https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_gazebo/launch/sim.launch.py): `RasPi/src/agv_gazebo/launch/sim.launch.py`
- [Warehouse generation](https://github.com/vq-vinh/da2-robot-agv/blob/main/RasPi/src/agv_gazebo/scripts/make_warehouse.py): `RasPi/src/agv_gazebo/scripts/make_warehouse.py`

### STM32 firmware

- [Firmware app tasks](https://github.com/vq-vinh/da2-robot-agv/blob/main/STM32/App/Src/app.c): `STM32/App/Src/app.c`
- [Speed control](https://github.com/vq-vinh/da2-robot-agv/blob/main/STM32/App/Src/speed_ctrl.c): `STM32/App/Src/speed_ctrl.c`
- [Motor driver](https://github.com/vq-vinh/da2-robot-agv/blob/main/STM32/Modules/Src/motor.c): `STM32/Modules/Src/motor.c`
- [Encoder driver](https://github.com/vq-vinh/da2-robot-agv/blob/main/STM32/Modules/Src/encoder.c): `STM32/Modules/Src/encoder.c`
- [UART transport](https://github.com/vq-vinh/da2-robot-agv/blob/main/STM32/Modules/Src/uart_tx.c): `STM32/Modules/Src/uart_tx.c`

### Control tools

- [Live tuning](https://github.com/vq-vinh/da2-robot-agv/blob/main/STM32/tools/tune.py): `STM32/tools/tune.py`
- [Speed log analysis](https://github.com/vq-vinh/da2-robot-agv/blob/main/STM32/tools/plot_speed.py): `STM32/tools/plot_speed.py`

### Other components

- **Operator**

## Connections

- Operator → Web dashboard: submits orders (evidence: `README.md`)
- Web dashboard → Order manager: serves requests (evidence: `README.md`)
- Mission launch → Order manager: starts mission (evidence: `RasPi/src/agv_mission/launch/mission.launch.py`)
- Order manager → Nav2 navigation: dispatches goals (evidence: `README.md`)
- Nav2 navigation → Localization and EKF: uses pose (evidence: `README.md`)
- Shelf detection → Nav2 navigation: provides shelf pose (evidence: `README.md`)
- Payload handling → Nav2 navigation: filters scans (evidence: `README.md`)
- SLAM → Nav2 navigation: provides mapping
- Gazebo simulation → Warehouse generation: uses generated world
- Gazebo simulation → Robot description: loads robot model
- Gazebo simulation → Nav2 navigation: runs navigation (evidence: `README.md`)
- Nav2 navigation → Firmware app tasks: planned command link
- Firmware app tasks → Speed control: runs control (evidence: `STM32/App/Src/app.c`)
- Firmware app tasks → Encoder driver: samples encoder (evidence: `STM32/App/Src/app.c`)
- Firmware app tasks → UART transport: sends log data (evidence: `STM32/App/Src/app.c`)
- Speed control → Motor driver: sets motor output (evidence: `STM32/App/Src/speed_ctrl.c`)
- Speed control → Encoder driver: reads speed (evidence: `STM32/App/Src/speed_ctrl.c`)
- Live tuning → Firmware app tasks: sends UART commands (evidence: `STM32/tools/tune.py`)
- UART transport → Live tuning: streams telemetry
- Live tuning → Speed log analysis: records logs (evidence: `STM32/tools/tune.py`)
