# umrover/mrover-esw architecture

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

- Interactive diagram: https://gitdiagram.com/umrover/mrover-esw
- Repository: https://github.com/umrover/mrover-esw

## Overview

MRover ESW is an embedded firmware repository for STM32 rover boards, with shared hardware/runtime libraries and Python utilities for CAN, configuration, and project generation. The main firmware workflows are board-specific: initialize peripherals, then run board logic that controls hardware or gathers sensor data; boards communicate over CAN. The sampled excerpts confirm several entry-point calls and BMC hardware setup, but do not show most application internals, so uncertain wiring is omitted.

Main entry points: [`src/bmc/Src/controller.cpp`](https://github.com/umrover/mrover-esw/blob/main/src/bmc/Src/controller.cpp) (BMC motor controller), [`tools/esw/can`](https://github.com/umrover/mrover-esw/tree/main/tools/esw/can) (CAN utilities), [`src/lim/Src/main.c`](https://github.com/umrover/mrover-esw/blob/main/src/lim/Src/main.c) (Limit entry point), [`src/science/Src/main.c`](https://github.com/umrover/mrover-esw/blob/main/src/science/Src/main.c) (Science entry point)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boards["Board firmware"]
  node_bmc["BMC motor controller<br/>[controller.cpp]"]
  node_limit["Limit board<br/>[lim.cpp]"]
  node_science["Science board<br/>[science.cpp]"]
  node_pdlb["PDLB board<br/>[pdlb.cpp]"]
  node_abs["Absolute encoder board<br/>[abs.cpp]"]
  node_bmcmain["BMC entry point<br/>[main.c]"]
  node_limmain["Limit entry point<br/>[main.c]"]
  node_sciencemain["Science entry point<br/>[main.c]"]
  node_pdlbmain["PDLB entry point<br/>[main.c]"]
end

subgraph group_shared["Shared libraries"]
  node_dbc["DBC runtime<br/>[dbc_runtime.hpp]"]
  node_frame["Frame processing"]
  node_fileparser["DBC file parser<br/>[file_parser.cpp]"]
  node_hw["STM32 hardware drivers"]
  node_util["Control and utilities"]
end

subgraph group_tools["Python utilities"]
  node_canutils["CAN utilities"]
  node_dbctools["DBC parser / generator"]
  node_configtools["Configuration tools"]
  node_projecttools["Project generation"]
end

subgraph group_starter["Starter projects"]
  node_servo["Servo exercises"]
  node_temphumidity["Temperature / humidity exercise<br/>[th_sensor.cpp]"]
end

node_operator(("Rover host / operator"))
node_canbus{{"CAN bus"}}

node_limmain -->|"calls PostInit / Loop"| node_limit
node_sciencemain -->|"calls PostInit"| node_science
node_pdlbmain -->|"calls PostInit"| node_pdlb
node_bmc -->|"initializes peripherals"| node_hw
node_bmc -->|"sends CAN messages"| node_canbus
node_operator -.->|"uses CAN tools"| node_canutils
node_canutils -.->|"sends / monitors"| node_canbus
node_dbctools -.->|"supports DBC workflow"| node_dbc

click node_bmc "https://github.com/umrover/mrover-esw/blob/main/src/bmc/Src/controller.cpp"
click node_limit "https://github.com/umrover/mrover-esw/blob/main/src/lim/Src/lim.cpp"
click node_science "https://github.com/umrover/mrover-esw/blob/main/src/science/Src/science.cpp"
click node_pdlb "https://github.com/umrover/mrover-esw/blob/main/src/pdlb/Src/pdlb.cpp"
click node_abs "https://github.com/umrover/mrover-esw/blob/main/src/abs/Src/abs.cpp"
click node_bmcmain "https://github.com/umrover/mrover-esw/blob/main/src/bmc/Src/main.c"
click node_limmain "https://github.com/umrover/mrover-esw/blob/main/src/lim/Src/main.c"
click node_sciencemain "https://github.com/umrover/mrover-esw/blob/main/src/science/Src/main.c"
click node_pdlbmain "https://github.com/umrover/mrover-esw/blob/main/src/pdlb/Src/main.c"
click node_dbc "https://github.com/umrover/mrover-esw/blob/main/lib/dbc/runtime/include/dbc_runtime.hpp"
click node_frame "https://github.com/umrover/mrover-esw/blob/main/lib/dbc/runtime/src/frame_processor.cpp"
click node_fileparser "https://github.com/umrover/mrover-esw/blob/main/lib/dbc/runtime/src/file_parser.cpp"
click node_hw "https://github.com/umrover/mrover-esw/tree/main/lib/stm32/Inc"
click node_util "https://github.com/umrover/mrover-esw/tree/main/lib/util/Inc"
click node_canutils "https://github.com/umrover/mrover-esw/tree/main/tools/esw/can"
click node_dbctools "https://github.com/umrover/mrover-esw/tree/main/tools/esw/can/dbc"
click node_configtools "https://github.com/umrover/mrover-esw/tree/main/tools/esw/config"
click node_projecttools "https://github.com/umrover/mrover-esw/tree/main/tools/esw/cubemx"
click node_servo "https://github.com/umrover/mrover-esw/tree/main/starter-projects/servo"
click node_temphumidity "https://github.com/umrover/mrover-esw/blob/main/starter-projects/temp-humidity/Src/th_sensor.cpp"

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_bmc,node_limit,node_science,node_pdlb,node_abs,node_bmcmain,node_limmain,node_sciencemain,node_pdlbmain toneBlue
class node_dbc,node_frame,node_fileparser,node_hw,node_util toneAmber
class node_canutils,node_dbctools,node_configtools,node_projecttools toneMint
class node_servo,node_temphumidity toneRose
class node_operator,node_canbus toneIndigo
```

## Components

### Board firmware

- [BMC motor controller](https://github.com/umrover/mrover-esw/blob/main/src/bmc/Src/controller.cpp): `src/bmc/Src/controller.cpp`
- [Limit board](https://github.com/umrover/mrover-esw/blob/main/src/lim/Src/lim.cpp): `src/lim/Src/lim.cpp`
- [Science board](https://github.com/umrover/mrover-esw/blob/main/src/science/Src/science.cpp): `src/science/Src/science.cpp`
- [PDLB board](https://github.com/umrover/mrover-esw/blob/main/src/pdlb/Src/pdlb.cpp): `src/pdlb/Src/pdlb.cpp`
- [Absolute encoder board](https://github.com/umrover/mrover-esw/blob/main/src/abs/Src/abs.cpp): `src/abs/Src/abs.cpp`
- [BMC entry point](https://github.com/umrover/mrover-esw/blob/main/src/bmc/Src/main.c): `src/bmc/Src/main.c`
- [Limit entry point](https://github.com/umrover/mrover-esw/blob/main/src/lim/Src/main.c): `src/lim/Src/main.c`
- [Science entry point](https://github.com/umrover/mrover-esw/blob/main/src/science/Src/main.c): `src/science/Src/main.c`
- [PDLB entry point](https://github.com/umrover/mrover-esw/blob/main/src/pdlb/Src/main.c): `src/pdlb/Src/main.c`

### Shared libraries

- [DBC runtime](https://github.com/umrover/mrover-esw/blob/main/lib/dbc/runtime/include/dbc_runtime.hpp): `lib/dbc/runtime/include/dbc_runtime.hpp`
- [Frame processing](https://github.com/umrover/mrover-esw/blob/main/lib/dbc/runtime/src/frame_processor.cpp): `lib/dbc/runtime/src/frame_processor.cpp`
- [DBC file parser](https://github.com/umrover/mrover-esw/blob/main/lib/dbc/runtime/src/file_parser.cpp): `lib/dbc/runtime/src/file_parser.cpp`
- [STM32 hardware drivers](https://github.com/umrover/mrover-esw/tree/main/lib/stm32/Inc): `lib/stm32/Inc`
- [Control and utilities](https://github.com/umrover/mrover-esw/tree/main/lib/util/Inc): `lib/util/Inc`

### Python utilities

- [CAN utilities](https://github.com/umrover/mrover-esw/tree/main/tools/esw/can): `tools/esw/can`
- [DBC parser / generator](https://github.com/umrover/mrover-esw/tree/main/tools/esw/can/dbc): `tools/esw/can/dbc`
- [Configuration tools](https://github.com/umrover/mrover-esw/tree/main/tools/esw/config): `tools/esw/config`
- [Project generation](https://github.com/umrover/mrover-esw/tree/main/tools/esw/cubemx): `tools/esw/cubemx`

### Starter projects

- [Servo exercises](https://github.com/umrover/mrover-esw/tree/main/starter-projects/servo): `starter-projects/servo`
- [Temperature / humidity exercise](https://github.com/umrover/mrover-esw/blob/main/starter-projects/temp-humidity/Src/th_sensor.cpp): `starter-projects/temp-humidity/Src/th_sensor.cpp`

### Other components

- **Rover host / operator**
- **CAN bus**

## Connections

- Limit entry point → Limit board: calls PostInit / Loop
- Science entry point → Science board: calls PostInit
- PDLB entry point → PDLB board: calls PostInit
- BMC motor controller → STM32 hardware drivers: initializes peripherals
- BMC motor controller → CAN bus: sends CAN messages
- Rover host / operator → CAN utilities: uses CAN tools
- CAN utilities → CAN bus: sends / monitors
- DBC parser / generator → DBC runtime: supports DBC workflow
