# ankur6889/hlcs_v2 architecture

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

- Interactive diagram: https://gitdiagram.com/ankur6889/hlcs_v2
- Repository: https://github.com/ankur6889/hlcs_v2

## Overview

1. This is a ROS 2 Jazzy monorepo for a multi-robot industrial control system. The workspace is split into several ROS packages under `src/`, with clear separation between shared contracts, orchestration, vendor-specific robot support, scene management, forecasting, and GUI tools.

2. The architectural center is the fleet-manager/brand-launcher split. `hlcs_fleet_manager` owns robot registration, identity assignment, lifecycle state, and fleet services. It does not contain vendor-specific logic; instead it delegates robot startup and vendor wiring to brand packages through a common launcher abstraction in `hlcs_common`.

3. Vendor support is packaged per brand. `hlcs_brand_ur` and `hlcs_brand_kinova` each bundle both the brand launcher and the brand adapter/refiner side. These packages are where driver-specific concerns live: URSim Docker orchestration, dashboard/program handling, ghost synchronization, Kinova `ros2_control` and gRPC setup, controller YAML generation, and vendor state translation.

4. The adapter boundary is important. Each brand package exposes a robot-facing adapter that translates vendor state into the HLCS contract: a generic `core_states` stream, vendor-specific state messages, and a single `robot_command` action. This is the main interface the GUI consumes, and it keeps the Commander brand-agnostic.

5. `hlcs_commander` is the human-facing control layer. It is a PySide6/QML application with per-robot tabs for control, motion, forecast, interfaces, config, and logs, plus fleet/scene/system tabs. It talks to ROS 2 through a Python backend, but it does not launch robot processes directly; it interacts with the fleet manager, adapters, and scene services.

6. `hlcs_msgs` defines the shared ROS API used across the whole system. It contains custom messages, services, and actions for fleet state, robot identity, capabilities, forecast control, scene loading, and robot add/remove operations. This package is the cross-cutting schema layer that keeps the other packages interoperable.

7. `hlcs_common` holds shared code rather than runtime features. It provides the `RobotIdentity` concept, base classes like the adapter and brand launcher abstractions, QoS profile helpers, constants, and logging utilities. This package is what enforces the common contract between fleet, brands, and GUI-facing components.

8. Scene handling is isolated in `hlcs_scene`. It loads environment URDFs, publishes static transforms for robot mount points, and serves scene-related services such as load/unload and mount assignment. The scene system is intentionally separate from fleet orchestration so robot placement and environment description stay independent of vendor drivers.

9. Forecasting is a separate system service in `hlcs_forecast`. Its role is to record and replay ghost robot motion using bag files, providing preview/approval workflows before executing on the real robot. This sits above the brands: it is brand-agnostic, but it depends on each brand package’s ghost stack and joint-state stream.

10. The ghost concept is implemented at the brand-launcher layer, not in the GUI or fleet manager. For both UR and Kinova, the brand launcher brings up a real stack and a ghost stack together, then keeps the ghost synchronized with the real robot’s joint state. That makes “forecasting” a runtime feature of the brand package rather than a separate simulator application.

11. `hlcs_robot_registry` is the configuration catalog. Its YAML files declare supported brands, models, capabilities, scene definitions, and mount metadata, including which launcher and adapter executables belong to each brand. The fleet manager and GUI use this registry to stay data-driven instead of hardcoding supported robots.

12. `hlcs_program_builder` is a separate PySide6/QML application for constructing motion programs. It stores waypoint-based programs in YAML and can execute them through MoveIt services. It is adjacent to the Commander workflow, but it is its own tool rather than a subsystem embedded into the main GUI.

13. The main runtime flow is: Commander starts the fleet manager and scene manager, the user adds a robot through the fleet manager, the chosen brand launcher spawns the vendor driver stack, and the adapter exposes normalized state back to the GUI. Scene assignment and forecast control then operate through their own ROS services and topics, not through direct GUI-to-driver coupling.

14. The repo also contains some non-runtime artifacts that matter for architecture understanding: `notes/architecture.md` and `notes/development_journal.md` document the design rules and rationale, while `src/user_programs/` holds example UR programs. These are useful for understanding system behavior, but they are not core runtime components.

Main entry points: [`src/hlcs_msgs`](https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_msgs) (ROS API), [`src/hlcs_fleet_manager`](https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_fleet_manager) (Fleet Manager), [`src/hlcs_commander`](https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_commander) (Commander), [`src/hlcs_common`](https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_common) (Common)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_runtime["Runtime services"]
  node_fleet_manager["Fleet Manager<br/>ROS 2 node"]
  node_scene_manager["Scene Manager<br/>ROS 2 node"]
  node_forecast_manager["Forecast Manager<br/>ROS 2 node"]
  node_fleet_node["Fleet Node<br/>ROS node"]
  node_fleet_core["Fleet Core<br/>fleet logic<br/>[fleet_manager.py]"]
  node_scene_core["Scene Core<br/>scene logic<br/>[scene_manager.py]"]
  node_forecast_core["Forecast Core<br/>forecast logic"]
end

subgraph group_grp_brands["Brand stacks"]
  node_ur_brand["UR Brand<br/>launcher+adapter"]
  node_kinova_brand["Kinova Brand<br/>launcher+adapter"]
  node_ur_adapter["UR Adapter<br/>vendor adapter<br/>[ur_adapter.py]"]
  node_ur_launcher["UR Launcher<br/>brand launcher"]
  node_kinova_adapter["Kinova Adapter<br/>vendor adapter<br/>[kinova_adapter.py]"]
  node_kinova_launcher["Kinova Launcher<br/>brand launcher"]
end

subgraph group_grp_ui["Operator tools"]
  node_commander["Commander<br/>PySide6/QML app"]
  node_program_builder["Program Builder<br/>QML tool"]
end

subgraph group_grp_shared["Shared contract"]
  node_common["Common<br/>shared bases"]
  node_msgs["ROS API<br/>msg/srv/action"]
end

subgraph group_grp_data["Registry and assets"]
  node_registry["Registry<br/>catalog"]
  node_user_programs["User Programs<br/>YAML assets"]
end

node_commander -->|"fleet control"| node_fleet_manager
node_commander -->|"scene control"| node_scene_manager
node_commander -->|"forecast UI"| node_forecast_manager
node_commander -.->|"adjacent tool"| node_program_builder
node_commander -->|"ROS contract"| node_msgs
node_program_builder -->|"robot services"| node_msgs
node_fleet_manager -->|"shared base"| node_common
node_fleet_manager -->|"fleet api"| node_msgs
node_fleet_manager -->|"brand lookup"| node_registry
node_fleet_manager -->|"launch brand"| node_ur_launcher
node_fleet_manager -->|"launch brand"| node_kinova_launcher
node_scene_manager -->|"scene api"| node_msgs
node_scene_manager -->|"scene data"| node_registry
node_forecast_manager -->|"forecast api"| node_msgs
node_forecast_manager -->|"ghost sync"| node_ur_brand
node_forecast_manager -->|"ghost sync"| node_kinova_brand
node_ur_launcher -->|"expose state"| node_ur_adapter
node_ur_launcher -->|"launcher base"| node_common
node_ur_adapter -->|"normalized api"| node_msgs
node_kinova_launcher -->|"expose state"| node_kinova_adapter
node_kinova_launcher -->|"launcher base"| node_common
node_kinova_adapter -->|"normalized api"| node_msgs
node_registry -->|"schema-aligned"| node_msgs
node_user_programs -.->|"example input"| node_program_builder
node_common -->|"contract layer"| node_msgs
node_fleet_node -->|"implements"| node_fleet_core
node_fleet_core -->|"uses identity"| node_common
node_scene_core -->|"scene services"| node_msgs
node_forecast_core -->|"forecast services"| node_msgs

click node_commander "https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_commander"
click node_program_builder "https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_program_builder"
click node_fleet_manager "https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_fleet_manager"
click node_scene_manager "https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_scene"
click node_forecast_manager "https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_forecast"
click node_ur_brand "https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_brand_ur"
click node_kinova_brand "https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_brand_kinova"
click node_common "https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_common"
click node_msgs "https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_msgs"
click node_registry "https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_robot_registry"
click node_user_programs "https://github.com/ankur6889/hlcs_v2/tree/main/src/user_programs"
click node_fleet_node "https://github.com/ankur6889/hlcs_v2/blob/main/src/hlcs_fleet_manager/hlcs_fleet_manager/fleet_manager_node.py"
click node_fleet_core "https://github.com/ankur6889/hlcs_v2/blob/main/src/hlcs_fleet_manager/hlcs_fleet_manager/fleet_manager.py"
click node_scene_core "https://github.com/ankur6889/hlcs_v2/blob/main/src/hlcs_scene/hlcs_scene/scene_manager.py"
click node_forecast_core "https://github.com/ankur6889/hlcs_v2/blob/main/src/hlcs_forecast/hlcs_forecast/forecast_manager.py"
click node_ur_adapter "https://github.com/ankur6889/hlcs_v2/blob/main/src/hlcs_brand_ur/hlcs_brand_ur/ur/ur_adapter.py"
click node_ur_launcher "https://github.com/ankur6889/hlcs_v2/blob/main/src/hlcs_brand_ur/hlcs_brand_ur/ur/ur_brand_launcher.py"
click node_kinova_adapter "https://github.com/ankur6889/hlcs_v2/blob/main/src/hlcs_brand_kinova/hlcs_brand_kinova/kinova/kinova_adapter.py"
click node_kinova_launcher "https://github.com/ankur6889/hlcs_v2/blob/main/src/hlcs_brand_kinova/hlcs_brand_kinova/kinova/kinova_brand_launcher.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_fleet_manager,node_scene_manager,node_forecast_manager,node_fleet_node,node_fleet_core,node_scene_core,node_forecast_core toneBlue
class node_ur_brand,node_kinova_brand,node_ur_adapter,node_ur_launcher,node_kinova_adapter,node_kinova_launcher toneAmber
class node_commander,node_program_builder toneMint
class node_common,node_msgs toneRose
class node_registry,node_user_programs toneIndigo
```

## Components

### Runtime services

Core ROS 2 services that coordinate robots, scenes, and forecasting.

- [Fleet Manager](https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_fleet_manager): ROS 2 node · Owns robot registration, identity assignment, lifecycle state, and fleet services. · `src/hlcs_fleet_manager`
- [Scene Manager](https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_scene): ROS 2 node · Loads scenes, publishes mount transforms, and serves scene services. · `src/hlcs_scene`
- [Forecast Manager](https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_forecast): ROS 2 node · Coordinates forecast record/replay workflows for ghost robot motion. · `src/hlcs_forecast`
- [Fleet Node](https://github.com/ankur6889/hlcs_v2/blob/main/src/hlcs_fleet_manager/hlcs_fleet_manager/fleet_manager_node.py): ROS node · Fleet manager node implementation and launch entrypoint. · `src/hlcs_fleet_manager/hlcs_fleet_manager/fleet_manager_node.py`
- [Fleet Core](https://github.com/ankur6889/hlcs_v2/blob/main/src/hlcs_fleet_manager/hlcs_fleet_manager/fleet_manager.py): fleet logic · Fleet orchestration logic and port allocation. · `src/hlcs_fleet_manager/hlcs_fleet_manager/fleet_manager.py`
- [Scene Core](https://github.com/ankur6889/hlcs_v2/blob/main/src/hlcs_scene/hlcs_scene/scene_manager.py): scene logic · Scene loading and mount-management implementation. · `src/hlcs_scene/hlcs_scene/scene_manager.py`
- [Forecast Core](https://github.com/ankur6889/hlcs_v2/blob/main/src/hlcs_forecast/hlcs_forecast/forecast_manager.py): forecast logic · Bag recording, playback, and forecast coordination. · `src/hlcs_forecast/hlcs_forecast/forecast_manager.py`

### Brand stacks

Vendor-specific launchers, adapters, and ghost support.

- [UR Brand](https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_brand_ur): launcher+adapter · Universal Robots launcher, adapter, ghost manager, and vendor-specific helpers. · `src/hlcs_brand_ur`
- [Kinova Brand](https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_brand_kinova): launcher+adapter · Kinova launcher, adapter, ghost manager, and controller setup. · `src/hlcs_brand_kinova`
- [UR Adapter](https://github.com/ankur6889/hlcs_v2/blob/main/src/hlcs_brand_ur/hlcs_brand_ur/ur/ur_adapter.py): vendor adapter · Normalizes UR states into HLCS core states and robot commands. · `src/hlcs_brand_ur/hlcs_brand_ur/ur/ur_adapter.py`
- [UR Launcher](https://github.com/ankur6889/hlcs_v2/blob/main/src/hlcs_brand_ur/hlcs_brand_ur/ur/ur_brand_launcher.py): brand launcher · Starts UR real and ghost stacks and handles UR-specific orchestration. · `src/hlcs_brand_ur/hlcs_brand_ur/ur/ur_brand_launcher.py`
- [Kinova Adapter](https://github.com/ankur6889/hlcs_v2/blob/main/src/hlcs_brand_kinova/hlcs_brand_kinova/kinova/kinova_adapter.py): vendor adapter · Normalizes Kinova states into HLCS core states and robot commands. · `src/hlcs_brand_kinova/hlcs_brand_kinova/kinova/kinova_adapter.py`
- [Kinova Launcher](https://github.com/ankur6889/hlcs_v2/blob/main/src/hlcs_brand_kinova/hlcs_brand_kinova/kinova/kinova_brand_launcher.py): brand launcher · Starts Kinova real and ghost stacks and handles vendor orchestration. · `src/hlcs_brand_kinova/hlcs_brand_kinova/kinova/kinova_brand_launcher.py`

### Operator tools

Human-facing applications for fleet control and program authoring.

- [Commander](https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_commander): PySide6/QML app · Main operator UI for fleet, robot, scene, forecast, settings, and logs. · `src/hlcs_commander`
- [Program Builder](https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_program_builder): QML tool · Standalone application for waypoint-based program authoring and execution. · `src/hlcs_program_builder`

### Shared contract

Common abstractions and ROS API schema used across the repo.

- [Common](https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_common): shared bases · Shared identity, launcher, adapter, QoS, constants, and logging utilities. · `src/hlcs_common`
- [ROS API](https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_msgs): msg/srv/action · Shared messages, services, and actions for fleet, scene, forecast, and robot commands. · `src/hlcs_msgs`

### Registry and assets

Data-driven robot, scene, and example program definitions.

- [Registry](https://github.com/ankur6889/hlcs_v2/tree/main/src/hlcs_robot_registry): catalog · YAML catalog of supported brands, scenes, capabilities, and launcher metadata. · `src/hlcs_robot_registry`
- [User Programs](https://github.com/ankur6889/hlcs_v2/tree/main/src/user_programs): YAML assets · Example user-authored motion programs stored as YAML. · `src/user_programs`

## Connections

- Commander → Fleet Manager: fleet control · Commander drives robot add/remove, selection, and fleet state through ROS services.
- Commander → Scene Manager: scene control · Commander loads and unloads scenes and assigns robot mounts.
- Commander → Forecast Manager: forecast UI · Commander triggers forecast launch, stop, and approval workflows.
- Commander → Program Builder: adjacent tool · Program Builder is a separate operator application, not embedded in Commander.
- Commander → ROS API: ROS contract · Commander consumes the shared ROS messages, services, and actions.
- Program Builder → ROS API: robot services · Program Builder executes motion programs through shared ROS services.
- Fleet Manager → Common: shared base · Fleet manager relies on common identity and launcher abstractions.
- Fleet Manager → ROS API: fleet api · Fleet manager implements fleet state and robot lifecycle services.
- Fleet Manager → Registry: brand lookup · Fleet manager uses registry data to resolve supported brands and launch metadata.
- Fleet Manager → UR Launcher: launch brand · Fleet manager delegates startup to the selected brand launcher.
- Fleet Manager → Kinova Launcher: launch brand · Fleet manager delegates startup to the selected brand launcher.
- Scene Manager → ROS API: scene api · Scene manager serves load/unload and mount assignment services.
- Scene Manager → Registry: scene data · Scene manager consumes scene definitions from the registry.
- Forecast Manager → ROS API: forecast api · Forecast manager provides forecast launch and stop services.
- Forecast Manager → UR Brand: ghost sync · Forecast workflows depend on brand ghost stacks and joint-state streams.
- Forecast Manager → Kinova Brand: ghost sync · Forecast workflows depend on brand ghost stacks and joint-state streams.
- UR Launcher → UR Adapter: expose state · UR launcher pairs the runtime stack with the adapter boundary.
- UR Launcher → Common: launcher base · UR launcher builds on the shared brand launcher abstraction.
- UR Adapter → ROS API: normalized api · UR adapter publishes core states, vendor states, and robot command actions.
- Kinova Launcher → Kinova Adapter: expose state · Kinova launcher pairs the runtime stack with the adapter boundary.
- Kinova Launcher → Common: launcher base · Kinova launcher builds on the shared brand launcher abstraction.
- Kinova Adapter → ROS API: normalized api · Kinova adapter publishes core states, vendor states, and robot command actions.
- Registry → ROS API: schema-aligned · Registry metadata mirrors the shared robot, scene, and capability contracts.
- User Programs → Program Builder: example input · Example YAML programs illustrate the program builder workflow.
- Common → ROS API: contract layer · Shared code underpins the cross-package HLCS contract.
- Fleet Node → Fleet Core: implements · Fleet node hosts the fleet orchestration logic.
- Fleet Core → Common: uses identity · Fleet orchestration uses shared robot identity and base abstractions.
- Scene Core → ROS API: scene services · Scene implementation backs the scene-related ROS API.
- Forecast Core → ROS API: forecast services · Forecast implementation backs the forecast-related ROS API.
