# michaelkapteyn/uav-digital-twin architecture

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

- Interactive diagram: https://gitdiagram.com/michaelkapteyn/uav-digital-twin
- Repository: https://github.com/michaelkapteyn/uav-digital-twin

## Overview

This ROS 2 research demonstration simulates a UAV and closes a control loop with a probabilistic digital twin: the asset advances under the twin’s control and returns simulated sensor measurements; the twin updates its model, plans control, and publishes estimates for visualization. The graph also preserves the documented GUI plugins and optional logger. Source excerpts show the asset/twin loop, model/planner calls, and several visualization subscriptions; README statements support launch composition and documented plugin roles where individual wiring was not sampled.

Main entry points: [`src/digitaltwin/nodes/twin.py`](https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/nodes/twin.py) (Twin Node), [`src/digitaltwin/launch/digitaltwin_launch_gui_logger.py`](https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/launch/digitaltwin_launch_gui_logger.py) (ROS Launch), [`src/digitaltwin/nodes/asset.py`](https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/nodes/asset.py) (UAV Asset), [`src/digitaltwin/digitaltwin/UAV.py`](https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/digitaltwin/UAV.py) (UAV Simulator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["UAV Simulation"]
  node_asset["UAV Asset<br/>[asset.py]"]
  node_uav["UAV Simulator<br/>[UAV.py]"]
  node_config["UAV Config<br/>[UAVconfig.json]"]
end

subgraph group_twin["Twin Inference"]
  node_twin_node["Twin Node<br/>[twin.py]"]
  node_model["Graphical Model<br/>[graphicalmodel.py]"]
  node_planner["Control Planner<br/>[planner.py]"]
  node_utils["Model Utilities<br/>[utils.py]"]
end

subgraph group_visualization["Rqt Visualization"]
  node_state_view["State Plot<br/>[ROSstate.py]"]
  node_trajectory_view["Trajectory Plot<br/>[ROStrajectory.py]"]
  node_sensor_view["Sensor Plot<br/>[ROSsensor.py]"]
  node_control_view["Control Plot<br/>[ROScontrol.py]"]
  node_reward_view["Reward Plot<br/>[ROSreward.py]"]
  node_network_view["Network View<br/>[ROSnetwork.py]"]
end

subgraph group_runtime["Run and Logging"]
  node_launch["ROS Launch"]
  node_logger["Logger Node<br/>[logger.py]"]
end

node_operator(("Operator"))

node_operator -->|"starts"| node_launch
node_launch -->|"launches"| node_asset
node_launch -->|"launches"| node_twin_node
node_launch -.->|"optionally launches"| node_logger
node_asset -->|"generates measurements"| node_uav
node_uav -->|"loads observations"| node_config
node_asset -->|"sends sensor data"| node_twin_node
node_twin_node -->|"sends control"| node_asset
node_twin_node -->|"updates and queries"| node_model
node_twin_node -->|"gets policy"| node_planner
node_model -->|"uses"| node_utils
node_uav -->|"uses"| node_utils
node_twin_node -->|"publishes state estimates"| node_state_view
node_twin_node -->|"publishes state estimates"| node_trajectory_view
node_twin_node -->|"publishes sensor estimates"| node_sensor_view
node_twin_node -->|"publishes control estimates"| node_control_view
node_twin_node -->|"publishes rewards"| node_reward_view
node_twin_node -->|"publishes graph"| node_network_view

click node_launch "https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/launch/digitaltwin_launch_gui_logger.py"
click node_asset "https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/nodes/asset.py"
click node_uav "https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/digitaltwin/UAV.py"
click node_config "https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/inputfiles/UAVconfig.json"
click node_twin_node "https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/nodes/twin.py"
click node_model "https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/digitaltwin/graphicalmodel.py"
click node_planner "https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/digitaltwin/planner.py"
click node_utils "https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/digitaltwin/utils.py"
click node_logger "https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/nodes/logger.py"
click node_state_view "https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/rqt_state/src/rqt_state/ROSstate.py"
click node_trajectory_view "https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/rqt_trajectory/src/rqt_trajectory/ROStrajectory.py"
click node_sensor_view "https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/rqt_sensor/src/rqt_sensor/ROSsensor.py"
click node_control_view "https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/rqt_control/src/rqt_control/ROScontrol.py"
click node_reward_view "https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/rqt_reward/src/rqt_reward/ROSreward.py"
click node_network_view "https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/rqt_network/src/rqt_network/ROSnetwork.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_asset,node_uav,node_config toneBlue
class node_twin_node,node_model,node_planner,node_utils toneAmber
class node_state_view,node_trajectory_view,node_sensor_view,node_control_view,node_reward_view,node_network_view toneMint
class node_launch,node_logger toneRose
class node_operator toneIndigo
```

## Components

### UAV Simulation

- [UAV Asset](https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/nodes/asset.py): `src/digitaltwin/nodes/asset.py`
- [UAV Simulator](https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/digitaltwin/UAV.py): `src/digitaltwin/digitaltwin/UAV.py`
- [UAV Config](https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/inputfiles/UAVconfig.json): `src/digitaltwin/inputfiles/UAVconfig.json`

### Twin Inference

- [Twin Node](https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/nodes/twin.py): `src/digitaltwin/nodes/twin.py`
- [Graphical Model](https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/digitaltwin/graphicalmodel.py): `src/digitaltwin/digitaltwin/graphicalmodel.py`
- [Control Planner](https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/digitaltwin/planner.py): `src/digitaltwin/digitaltwin/planner.py`
- [Model Utilities](https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/digitaltwin/utils.py): `src/digitaltwin/digitaltwin/utils.py`

### Rqt Visualization

- [State Plot](https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/rqt_state/src/rqt_state/ROSstate.py): `src/rqt_state/src/rqt_state/ROSstate.py`
- [Trajectory Plot](https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/rqt_trajectory/src/rqt_trajectory/ROStrajectory.py): `src/rqt_trajectory/src/rqt_trajectory/ROStrajectory.py`
- [Sensor Plot](https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/rqt_sensor/src/rqt_sensor/ROSsensor.py): `src/rqt_sensor/src/rqt_sensor/ROSsensor.py`
- [Control Plot](https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/rqt_control/src/rqt_control/ROScontrol.py): `src/rqt_control/src/rqt_control/ROScontrol.py`
- [Reward Plot](https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/rqt_reward/src/rqt_reward/ROSreward.py): `src/rqt_reward/src/rqt_reward/ROSreward.py`
- [Network View](https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/rqt_network/src/rqt_network/ROSnetwork.py): `src/rqt_network/src/rqt_network/ROSnetwork.py`

### Run and Logging

- [ROS Launch](https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/launch/digitaltwin_launch_gui_logger.py): `src/digitaltwin/launch/digitaltwin_launch_gui_logger.py`
- [Logger Node](https://github.com/michaelkapteyn/uav-digital-twin/blob/master/src/digitaltwin/nodes/logger.py): `src/digitaltwin/nodes/logger.py`

### Other components

- **Operator**

## Connections

- Operator → ROS Launch: starts (evidence: `README.md`)
- ROS Launch → UAV Asset: launches (evidence: `README.md`)
- ROS Launch → Twin Node: launches (evidence: `README.md`)
- ROS Launch → Logger Node: optionally launches (evidence: `README.md`)
- UAV Asset → UAV Simulator: generates measurements (evidence: `src/digitaltwin/nodes/asset.py`)
- UAV Simulator → UAV Config: loads observations (evidence: `src/digitaltwin/digitaltwin/UAV.py`)
- UAV Asset → Twin Node: sends sensor data (evidence: `README.md`)
- Twin Node → UAV Asset: sends control (evidence: `README.md`)
- Twin Node → Graphical Model: updates and queries (evidence: `src/digitaltwin/nodes/twin.py`)
- Twin Node → Control Planner: gets policy (evidence: `src/digitaltwin/nodes/twin.py`)
- Graphical Model → Model Utilities: uses (evidence: `src/digitaltwin/digitaltwin/graphicalmodel.py`)
- UAV Simulator → Model Utilities: uses (evidence: `src/digitaltwin/digitaltwin/UAV.py`)
- Twin Node → State Plot: publishes state estimates (evidence: `README.md`)
- Twin Node → Trajectory Plot: publishes state estimates (evidence: `README.md`)
- Twin Node → Sensor Plot: publishes sensor estimates (evidence: `README.md`)
- Twin Node → Control Plot: publishes control estimates (evidence: `README.md`)
- Twin Node → Reward Plot: publishes rewards (evidence: `src/digitaltwin/nodes/twin.py`)
- Twin Node → Network View: publishes graph (evidence: `src/digitaltwin/nodes/twin.py`)
