# schradivarius/urc-task3 architecture

> Architecture diagram of the GitHub repository schradivarius/urc-task3, 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/schradivarius/urc-task3
- Repository: https://github.com/schradivarius/urc-task3

## Overview

URC Rover is a Jetson-to-Teensy CAN command and telemetry link with a shared wire protocol and watchdog-based fail-safe control. The principal workflow is: the Jetson sends CONTROL frames, the Teensy validates commands and applies safe outputs, and the Teensy returns motion and status telemetry. README statements establish the firmware wiring and host harness roles; the sampled sources show codec, controller, and simulator details. Hardware validation is not documented as complete, and motor and sensor I/O are stubs.

Main entry points: [`firmware/rover_firmware.ino`](https://github.com/schradivarius/urc-task3/blob/main/firmware/rover_firmware.ino) (Hardware Wiring), [`firmware/src/rover_controller.cpp`](https://github.com/schradivarius/urc-task3/blob/main/firmware/src/rover_controller.cpp) (Safety Controller), [`host/can_link.py`](https://github.com/schradivarius/urc-task3/blob/main/host/can_link.py) (CAN Backends), [`host/jetson_test.py`](https://github.com/schradivarius/urc-task3/blob/main/host/jetson_test.py) (Jetson Link Harness)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["Jetson Host"]
  node_host_harness["Jetson Link Harness<br/>[jetson_test.py]"]
  node_can_link["CAN Backends<br/>[can_link.py]"]
  node_host_telemetry["Telemetry Consumer<br/>[jetson_test.py]"]
end

subgraph group_protocol["CAN Protocol"]
  node_host_codec["Python Codec<br/>[rover_protocol.py]"]
  node_cpp_codec["C++ Codec<br/>[rover_protocol.cpp]"]
  node_protocol_spec["Message Definitions<br/>[rover_protocol.h]"]
  node_motion_telemetry["Motion Telemetry<br/>[rover_protocol.h]"]
  node_status_telemetry["Status Telemetry<br/>[rover_protocol.h]"]
end

subgraph group_firmware["Teensy Firmware"]
  node_firmware_wiring["Hardware Wiring<br/>[rover_firmware.ino]"]
  node_controller["Safety Controller"]
end

subgraph group_hardware["Rover Hardware"]
  node_motor_io["Motor Outputs<br/>[rover_firmware.ino]"]
  node_sensor_io["Sensor Inputs<br/>[rover_firmware.ino]"]
  node_rover_plant{{"Rover Plant"}}
end

node_operator(("Operator / Autonomy"))
node_can_bus{{"CAN Bus"}}

node_operator -.->|"sets commands"| node_host_harness
node_host_harness -.->|"encodes commands"| node_host_codec
node_host_harness -.->|"sends and receives"| node_can_link
node_can_link -.->|"transmits frames"| node_can_bus
node_can_bus -.->|"delivers frames"| node_firmware_wiring
node_firmware_wiring -.->|"routes frames"| node_controller
node_controller -->|"decodes CONTROL"| node_cpp_codec
node_controller -->|"uses definitions"| node_protocol_spec
node_firmware_wiring -.->|"encodes frames"| node_cpp_codec
node_controller -.->|"provides safe outputs"| node_motor_io
node_sensor_io -.->|"supplies readings"| node_controller
node_motor_io -.->|"drives"| node_rover_plant
node_rover_plant -.->|"produces measurements"| node_sensor_io
node_firmware_wiring -.->|"transmits telemetry"| node_can_bus
node_firmware_wiring -.->|"emits frames"| node_motion_telemetry
node_firmware_wiring -.->|"emits frames"| node_status_telemetry
node_can_bus -.->|"delivers frames"| node_can_link
node_can_link -.->|"passes frames"| node_host_telemetry
node_host_telemetry -.->|"decodes telemetry"| node_host_codec
node_host_codec -.->|"reports state"| node_operator

click node_host_harness "https://github.com/schradivarius/urc-task3/blob/main/host/jetson_test.py"
click node_host_codec "https://github.com/schradivarius/urc-task3/blob/main/host/rover_protocol.py"
click node_can_link "https://github.com/schradivarius/urc-task3/blob/main/host/can_link.py"
click node_firmware_wiring "https://github.com/schradivarius/urc-task3/blob/main/firmware/rover_firmware.ino"
click node_controller "https://github.com/schradivarius/urc-task3/blob/main/firmware/src/rover_controller.cpp"
click node_cpp_codec "https://github.com/schradivarius/urc-task3/blob/main/firmware/src/rover_protocol.cpp"
click node_protocol_spec "https://github.com/schradivarius/urc-task3/blob/main/firmware/src/rover_protocol.h"
click node_motor_io "https://github.com/schradivarius/urc-task3/blob/main/firmware/rover_firmware.ino"
click node_sensor_io "https://github.com/schradivarius/urc-task3/blob/main/firmware/rover_firmware.ino"
click node_motion_telemetry "https://github.com/schradivarius/urc-task3/blob/main/firmware/src/rover_protocol.h"
click node_status_telemetry "https://github.com/schradivarius/urc-task3/blob/main/firmware/src/rover_protocol.h"
click node_host_telemetry "https://github.com/schradivarius/urc-task3/blob/main/host/jetson_test.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_host_harness,node_can_link,node_host_telemetry toneBlue
class node_host_codec,node_cpp_codec,node_protocol_spec,node_motion_telemetry,node_status_telemetry toneAmber
class node_firmware_wiring,node_controller toneMint
class node_motor_io,node_sensor_io,node_rover_plant toneRose
class node_operator,node_can_bus toneIndigo
```

## Components

### Jetson Host

- [Jetson Link Harness](https://github.com/schradivarius/urc-task3/blob/main/host/jetson_test.py): `host/jetson_test.py`
- [CAN Backends](https://github.com/schradivarius/urc-task3/blob/main/host/can_link.py): `host/can_link.py`
- [Telemetry Consumer](https://github.com/schradivarius/urc-task3/blob/main/host/jetson_test.py): `host/jetson_test.py`

### CAN Protocol

- [Python Codec](https://github.com/schradivarius/urc-task3/blob/main/host/rover_protocol.py): `host/rover_protocol.py`
- [C++ Codec](https://github.com/schradivarius/urc-task3/blob/main/firmware/src/rover_protocol.cpp): `firmware/src/rover_protocol.cpp`
- [Message Definitions](https://github.com/schradivarius/urc-task3/blob/main/firmware/src/rover_protocol.h): `firmware/src/rover_protocol.h`
- [Motion Telemetry](https://github.com/schradivarius/urc-task3/blob/main/firmware/src/rover_protocol.h): `firmware/src/rover_protocol.h`
- [Status Telemetry](https://github.com/schradivarius/urc-task3/blob/main/firmware/src/rover_protocol.h): `firmware/src/rover_protocol.h`

### Teensy Firmware

- [Hardware Wiring](https://github.com/schradivarius/urc-task3/blob/main/firmware/rover_firmware.ino): `firmware/rover_firmware.ino`
- [Safety Controller](https://github.com/schradivarius/urc-task3/blob/main/firmware/src/rover_controller.cpp): `firmware/src/rover_controller.cpp`

### Rover Hardware

- [Motor Outputs](https://github.com/schradivarius/urc-task3/blob/main/firmware/rover_firmware.ino): `firmware/rover_firmware.ino`
- [Sensor Inputs](https://github.com/schradivarius/urc-task3/blob/main/firmware/rover_firmware.ino): `firmware/rover_firmware.ino`
- **Rover Plant**

### Other components

- **Operator / Autonomy**
- **CAN Bus**

## Connections

- Operator / Autonomy → Jetson Link Harness: sets commands (evidence: `README.md`)
- Jetson Link Harness → Python Codec: encodes commands (evidence: `README.md`)
- Jetson Link Harness → CAN Backends: sends and receives (evidence: `README.md`)
- CAN Backends → CAN Bus: transmits frames (evidence: `README.md`)
- CAN Bus → Hardware Wiring: delivers frames (evidence: `README.md`)
- Hardware Wiring → Safety Controller: routes frames (evidence: `README.md`)
- Safety Controller → C++ Codec: decodes CONTROL (evidence: `firmware/src/rover_controller.cpp`)
- Safety Controller → Message Definitions: uses definitions
- Hardware Wiring → C++ Codec: encodes frames (evidence: `README.md`)
- Safety Controller → Motor Outputs: provides safe outputs (evidence: `README.md`)
- Sensor Inputs → Safety Controller: supplies readings (evidence: `README.md`)
- Motor Outputs → Rover Plant: drives (evidence: `README.md`)
- Rover Plant → Sensor Inputs: produces measurements (evidence: `README.md`)
- Hardware Wiring → CAN Bus: transmits telemetry (evidence: `README.md`)
- Hardware Wiring → Motion Telemetry: emits frames (evidence: `README.md`)
- Hardware Wiring → Status Telemetry: emits frames (evidence: `README.md`)
- CAN Bus → CAN Backends: delivers frames (evidence: `README.md`)
- CAN Backends → Telemetry Consumer: passes frames (evidence: `README.md`)
- Telemetry Consumer → Python Codec: decodes telemetry (evidence: `README.md`)
- Python Codec → Operator / Autonomy: reports state (evidence: `README.md`)
