# stvy886/krai-2027 architecture

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

- Interactive diagram: https://gitdiagram.com/stvy886/krai-2027
- Repository: https://github.com/stvy886/krai-2027

## Overview

This ROS 2 package provides encoder acquisition, dead-wheel distance conversion, pose estimation, and a separate Modbus motor test node. The main data path is register reads → encoder counts → odometry distances → pose messages. `auto/odom.py` also contains PID and mecanum wheel-conversion methods, but the sampled node does not connect those methods to a command input or motor output. The README is empty; the map reflects the supplied source files.

Main entry points: [`auto/deadwheel.py`](https://github.com/stvy886/krai-2027/blob/main/auto/deadwheel.py) (Dead-wheel encoder), [`auto/modbus.py`](https://github.com/stvy886/krai-2027/blob/main/auto/modbus.py) (Modbus reader), [`auto/motor.py`](https://github.com/stvy886/krai-2027/blob/main/auto/motor.py) (Motor test node), [`auto/odom.py`](https://github.com/stvy886/krai-2027/blob/main/auto/odom.py) (Odometry node)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensing["Encoder sensing"]
  node_modbus["Modbus reader<br/>[modbus.py]"]
  node_encoder["Dead-wheel encoder<br/>[deadwheel.py]"]
end

subgraph group_navigation["Pose navigation"]
  node_odom["Odometry node<br/>[odom.py]"]
  node_navmath["PID and kinematics<br/>[odom.py]"]
end

subgraph group_actuation["Motor test"]
  node_motor["Motor test node<br/>[motor.py]"]
end

node_registers[("Encoder registers")]
node_distance["Wheel distances"]
node_pose["Robot pose"]
node_pose_client(("Pose subscriber"))
node_motor_register[("Motor register")]
node_test_client(("Test topic subscriber"))

node_modbus -->|"reads registers"| node_registers
node_modbus -->|"publishes counts"| node_encoder
node_encoder -->|"converts counts"| node_distance
node_encoder -->|"publishes distances"| node_odom
node_odom -->|"publishes pose"| node_pose
node_pose -->|"delivers pose"| node_pose_client
node_motor -->|"writes register"| node_motor_register
node_motor -->|"publishes test value"| node_test_client

click node_modbus "https://github.com/stvy886/krai-2027/blob/main/auto/modbus.py"
click node_encoder "https://github.com/stvy886/krai-2027/blob/main/auto/deadwheel.py"
click node_odom "https://github.com/stvy886/krai-2027/blob/main/auto/odom.py"
click node_navmath "https://github.com/stvy886/krai-2027/blob/main/auto/odom.py"
click node_motor "https://github.com/stvy886/krai-2027/blob/main/auto/motor.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_modbus,node_encoder toneBlue
class node_odom,node_navmath,node_registers,node_motor_register toneAmber
class node_motor toneMint
class node_distance,node_pose,node_pose_client,node_test_client toneIndigo
```

## Components

### Encoder sensing

- [Modbus reader](https://github.com/stvy886/krai-2027/blob/main/auto/modbus.py): `auto/modbus.py`
- [Dead-wheel encoder](https://github.com/stvy886/krai-2027/blob/main/auto/deadwheel.py): `auto/deadwheel.py`

### Pose navigation

- [Odometry node](https://github.com/stvy886/krai-2027/blob/main/auto/odom.py): `auto/odom.py`
- [PID and kinematics](https://github.com/stvy886/krai-2027/blob/main/auto/odom.py): `auto/odom.py`

### Motor test

- [Motor test node](https://github.com/stvy886/krai-2027/blob/main/auto/motor.py): `auto/motor.py`

### Other components

- **Encoder registers**
- **Wheel distances**
- **Robot pose**
- **Pose subscriber**
- **Motor register**
- **Test topic subscriber**

## Connections

- Modbus reader → Encoder registers: reads registers
- Modbus reader → Dead-wheel encoder: publishes counts
- Dead-wheel encoder → Wheel distances: converts counts
- Dead-wheel encoder → Odometry node: publishes distances
- Odometry node → Robot pose: publishes pose
- Robot pose → Pose subscriber: delivers pose
- Motor test node → Motor register: writes register
- Motor test node → Test topic subscriber: publishes test value
