# lo122/hrc_communication architecture

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

## Overview

This is an event-driven human–robot collaboration system: live or supplied recognition results can trigger assistance tasks; the decision layer requests human permission, manages task state and pending work, then dispatches accepted tasks and runtime controls to robot integrations. Communication supports CLI/voice and a browser permission interface. The README documents the intended end-to-end wiring; sampled source confirms recognition-trigger creation, task-manager actions, timers, and voice coordination, but orchestration and several adapters were not sampled, so uncertain internal links are omitted.

Main entry points: [`2_decision_making/task_manager.py`](https://github.com/lo122/hrc_communication/blob/main/2_decision_making/task_manager.py) (Task Manager), [`1_recognition/recognition_manager.py`](https://github.com/lo122/hrc_communication/blob/main/1_recognition/recognition_manager.py) (Recognition Manager), [`0_core/event_queue.py`](https://github.com/lo122/hrc_communication/blob/main/0_core/event_queue.py) (Event Queue), [`3_communication/communication_manager.py`](https://github.com/lo122/hrc_communication/blob/main/3_communication/communication_manager.py) (Communication Manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_recognition["Recognition"]
  node_recognition_manager["Recognition Manager"]
  node_skeleton_pipeline["3D Pose Pipeline"]
  node_motionbert["MotionBERT Lifter"]
  node_features["Motion Features<br/>[h36m_features.py]"]
  node_lstm["Step Classifier"]
  node_stabilizer["Step Stabilizer<br/>[step_stablizier.py]"]
  node_trigger["Trigger Manager<br/>[trigger_manager.py]"]
end

subgraph group_decision["Decision"]
  node_task_manager["Task Manager<br/>[task_manager.py]"]
  node_state_machine["State Machine<br/>[state_machine.py]"]
  node_pending_tasks["Pending Tasks<br/>[pending_task.py]"]
  node_timers["Task Timers<br/>[timer_manager.py]"]
end

subgraph group_communication["Communication"]
  node_cli["CLI Interface<br/>[cli_interface.py]"]
  node_parser["Command Parser<br/>[cmd_parser.py]"]
  node_messages["Message Manager<br/>[message_manager.py]"]
  node_voice["Voice Interface<br/>[voice_interface.py]"]
  node_communication_manager["Communication Manager"]
  node_tts["Speech Output<br/>[tts_manager.py]"]
  node_watch["Watch Interface<br/>[app.js]"]
  node_watch_server["Watch Server<br/>[server.py]"]
end

subgraph group_execution["Execution"]
  node_gh_dispatcher["GH Dispatcher<br/>[gh_dispatcher.py]"]
  node_udp_sender["UDP Sender<br/>[udp_sender.py]"]
  node_ros["ROS Communication"]
  node_ur_control["UR Control<br/>[ur_control.py]"]
  node_ur_state["UR State Reader<br/>[ur_state_reader.py]"]
end

subgraph group_core["Shared Core"]
  node_runtime["System Runtime"]
  node_event_queue["Event Queue<br/>[event_queue.py]"]
  node_event_transport["Event Transport<br/>[event_transport.py]"]
  node_events_models["Events and Models<br/>[events.py]"]
  node_logger["Event Logger<br/>[logger.py]"]
end

node_human(("Human"))
node_camera(("Camera"))
node_grasshopper["Grasshopper"]
node_robot["Robot / UR"]

node_camera -->|"provides frames"| node_recognition_manager
node_recognition_manager -->|"processes frames"| node_skeleton_pipeline
node_skeleton_pipeline -->|"lifts pose"| node_motionbert
node_recognition_manager -->|"extracts features"| node_features
node_recognition_manager -->|"classifies steps"| node_lstm
node_recognition_manager -->|"stabilizes steps"| node_stabilizer
node_recognition_manager -->|"supplies results"| node_trigger
node_trigger -->|"queues triggers"| node_event_queue
node_runtime -->|"processes events"| node_event_queue
node_runtime -->|"updates recognition"| node_recognition_manager
node_event_queue -->|"delivers events"| node_task_manager
node_task_manager -->|"validates transitions"| node_state_machine
node_task_manager -->|"manages pending"| node_pending_tasks
node_task_manager -->|"starts timers"| node_timers
node_timers -->|"emits timeout events"| node_event_queue
node_task_manager -->|"gets message text"| node_messages
node_task_manager -->|"requests messages"| node_cli
node_human -->|"enters commands"| node_cli
node_cli -->|"parses commands"| node_parser
node_communication_manager -->|"controls listening"| node_voice
node_communication_manager -->|"parses speech"| node_parser
node_communication_manager -->|"emits command events"| node_event_queue
node_communication_manager -->|"speaks messages"| node_tts
node_human -->|"selects response"| node_watch
node_watch -->|"sends permission"| node_watch_server
node_watch_server -->|"queues response"| node_event_queue
node_task_manager -->|"dispatches task"| node_gh_dispatcher
node_gh_dispatcher -->|"sends task data"| node_udp_sender
node_udp_sender -->|"sends task id and piece"| node_grasshopper
node_task_manager -->|"publishes controls"| node_ros
node_ros -->|"controls runtime"| node_robot
node_robot -->|"reports success"| node_ros
node_ros -->|"queues success event"| node_event_queue
node_ur_control -.->|"controls arm"| node_robot
node_robot -.->|"provides state"| node_ur_state
node_task_manager -->|"logs transitions"| node_logger

click node_recognition_manager "https://github.com/lo122/hrc_communication/blob/main/1_recognition/recognition_manager.py"
click node_skeleton_pipeline "https://github.com/lo122/hrc_communication/blob/main/1_recognition/skeleton3d_pipeline.py"
click node_motionbert "https://github.com/lo122/hrc_communication/blob/main/1_recognition/src/skeleton_pipeline/motionbert_lifter.py"
click node_features "https://github.com/lo122/hrc_communication/blob/main/1_recognition/src/skeleton_pipeline/features/h36m_features.py"
click node_lstm "https://github.com/lo122/hrc_communication/blob/main/1_recognition/best_model/LSTM_model_train.py"
click node_stabilizer "https://github.com/lo122/hrc_communication/blob/main/1_recognition/step_stablizier.py"
click node_trigger "https://github.com/lo122/hrc_communication/blob/main/1_recognition/trigger_manager.py"
click node_task_manager "https://github.com/lo122/hrc_communication/blob/main/2_decision_making/task_manager.py"
click node_state_machine "https://github.com/lo122/hrc_communication/blob/main/2_decision_making/state_machine.py"
click node_pending_tasks "https://github.com/lo122/hrc_communication/blob/main/2_decision_making/pending_task.py"
click node_timers "https://github.com/lo122/hrc_communication/blob/main/2_decision_making/timer_manager.py"
click node_cli "https://github.com/lo122/hrc_communication/blob/main/3_communication/cli_interface.py"
click node_parser "https://github.com/lo122/hrc_communication/blob/main/3_communication/cmd_parser.py"
click node_messages "https://github.com/lo122/hrc_communication/blob/main/3_communication/message_manager.py"
click node_voice "https://github.com/lo122/hrc_communication/blob/main/3_communication/voice_interface.py"
click node_communication_manager "https://github.com/lo122/hrc_communication/blob/main/3_communication/communication_manager.py"
click node_tts "https://github.com/lo122/hrc_communication/blob/main/3_communication/tts_manager.py"
click node_watch "https://github.com/lo122/hrc_communication/blob/main/Interface/app.js"
click node_watch_server "https://github.com/lo122/hrc_communication/blob/main/Interface/server.py"
click node_gh_dispatcher "https://github.com/lo122/hrc_communication/blob/main/4_execution/gh_dispatcher.py"
click node_udp_sender "https://github.com/lo122/hrc_communication/blob/main/4_execution/udp_sender.py"
click node_ros "https://github.com/lo122/hrc_communication/blob/main/4_execution/ros_communication.py"
click node_ur_control "https://github.com/lo122/hrc_communication/blob/main/4_execution/ur_control.py"
click node_ur_state "https://github.com/lo122/hrc_communication/blob/main/4_execution/ur_state_reader.py"
click node_runtime "https://github.com/lo122/hrc_communication/blob/main/communication_runtime.py"
click node_event_queue "https://github.com/lo122/hrc_communication/blob/main/0_core/event_queue.py"
click node_event_transport "https://github.com/lo122/hrc_communication/blob/main/0_core/event_transport.py"
click node_events_models "https://github.com/lo122/hrc_communication/blob/main/0_core/events.py"
click node_logger "https://github.com/lo122/hrc_communication/blob/main/0_core/logger.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_recognition_manager,node_skeleton_pipeline,node_motionbert,node_features,node_lstm,node_stabilizer,node_trigger toneBlue
class node_task_manager,node_state_machine,node_pending_tasks,node_timers toneAmber
class node_cli,node_parser,node_messages,node_voice,node_communication_manager,node_tts,node_watch,node_watch_server toneMint
class node_gh_dispatcher,node_udp_sender,node_ros,node_ur_control,node_ur_state toneRose
class node_runtime,node_event_queue,node_event_transport,node_events_models,node_logger,node_human,node_camera,node_grasshopper,node_robot toneIndigo
```

## Components

### Recognition

- [Recognition Manager](https://github.com/lo122/hrc_communication/blob/main/1_recognition/recognition_manager.py): `1_recognition/recognition_manager.py`
- [3D Pose Pipeline](https://github.com/lo122/hrc_communication/blob/main/1_recognition/skeleton3d_pipeline.py): `1_recognition/skeleton3d_pipeline.py`
- [MotionBERT Lifter](https://github.com/lo122/hrc_communication/blob/main/1_recognition/src/skeleton_pipeline/motionbert_lifter.py): `1_recognition/src/skeleton_pipeline/motionbert_lifter.py`
- [Motion Features](https://github.com/lo122/hrc_communication/blob/main/1_recognition/src/skeleton_pipeline/features/h36m_features.py): `1_recognition/src/skeleton_pipeline/features/h36m_features.py`
- [Step Classifier](https://github.com/lo122/hrc_communication/blob/main/1_recognition/best_model/LSTM_model_train.py): `1_recognition/best_model/LSTM_model_train.py`
- [Step Stabilizer](https://github.com/lo122/hrc_communication/blob/main/1_recognition/step_stablizier.py): `1_recognition/step_stablizier.py`
- [Trigger Manager](https://github.com/lo122/hrc_communication/blob/main/1_recognition/trigger_manager.py): `1_recognition/trigger_manager.py`

### Decision

- [Task Manager](https://github.com/lo122/hrc_communication/blob/main/2_decision_making/task_manager.py): `2_decision_making/task_manager.py`
- [State Machine](https://github.com/lo122/hrc_communication/blob/main/2_decision_making/state_machine.py): `2_decision_making/state_machine.py`
- [Pending Tasks](https://github.com/lo122/hrc_communication/blob/main/2_decision_making/pending_task.py): `2_decision_making/pending_task.py`
- [Task Timers](https://github.com/lo122/hrc_communication/blob/main/2_decision_making/timer_manager.py): `2_decision_making/timer_manager.py`

### Communication

- [CLI Interface](https://github.com/lo122/hrc_communication/blob/main/3_communication/cli_interface.py): `3_communication/cli_interface.py`
- [Command Parser](https://github.com/lo122/hrc_communication/blob/main/3_communication/cmd_parser.py): `3_communication/cmd_parser.py`
- [Message Manager](https://github.com/lo122/hrc_communication/blob/main/3_communication/message_manager.py): `3_communication/message_manager.py`
- [Voice Interface](https://github.com/lo122/hrc_communication/blob/main/3_communication/voice_interface.py): `3_communication/voice_interface.py`
- [Communication Manager](https://github.com/lo122/hrc_communication/blob/main/3_communication/communication_manager.py): `3_communication/communication_manager.py`
- [Speech Output](https://github.com/lo122/hrc_communication/blob/main/3_communication/tts_manager.py): `3_communication/tts_manager.py`
- [Watch Interface](https://github.com/lo122/hrc_communication/blob/main/Interface/app.js): `Interface/app.js`
- [Watch Server](https://github.com/lo122/hrc_communication/blob/main/Interface/server.py): `Interface/server.py`

### Execution

- [GH Dispatcher](https://github.com/lo122/hrc_communication/blob/main/4_execution/gh_dispatcher.py): `4_execution/gh_dispatcher.py`
- [UDP Sender](https://github.com/lo122/hrc_communication/blob/main/4_execution/udp_sender.py): `4_execution/udp_sender.py`
- [ROS Communication](https://github.com/lo122/hrc_communication/blob/main/4_execution/ros_communication.py): `4_execution/ros_communication.py`
- [UR Control](https://github.com/lo122/hrc_communication/blob/main/4_execution/ur_control.py): `4_execution/ur_control.py`
- [UR State Reader](https://github.com/lo122/hrc_communication/blob/main/4_execution/ur_state_reader.py): `4_execution/ur_state_reader.py`

### Shared Core

- [System Runtime](https://github.com/lo122/hrc_communication/blob/main/communication_runtime.py): `communication_runtime.py`
- [Event Queue](https://github.com/lo122/hrc_communication/blob/main/0_core/event_queue.py): `0_core/event_queue.py`
- [Event Transport](https://github.com/lo122/hrc_communication/blob/main/0_core/event_transport.py): `0_core/event_transport.py`
- [Events and Models](https://github.com/lo122/hrc_communication/blob/main/0_core/events.py): `0_core/events.py`
- [Event Logger](https://github.com/lo122/hrc_communication/blob/main/0_core/logger.py): `0_core/logger.py`

### Other components

- **Human**
- **Camera**
- **Grasshopper**
- **Robot / UR**

## Connections

- Camera → Recognition Manager: provides frames
- Recognition Manager → 3D Pose Pipeline: processes frames
- 3D Pose Pipeline → MotionBERT Lifter: lifts pose
- Recognition Manager → Motion Features: extracts features
- Recognition Manager → Step Classifier: classifies steps
- Recognition Manager → Step Stabilizer: stabilizes steps
- Recognition Manager → Trigger Manager: supplies results
- Trigger Manager → Event Queue: queues triggers
- System Runtime → Event Queue: processes events
- System Runtime → Recognition Manager: updates recognition
- Event Queue → Task Manager: delivers events
- Task Manager → State Machine: validates transitions
- Task Manager → Pending Tasks: manages pending
- Task Manager → Task Timers: starts timers
- Task Timers → Event Queue: emits timeout events
- Task Manager → Message Manager: gets message text
- Task Manager → CLI Interface: requests messages
- Human → CLI Interface: enters commands
- CLI Interface → Command Parser: parses commands
- Communication Manager → Voice Interface: controls listening
- Communication Manager → Command Parser: parses speech
- Communication Manager → Event Queue: emits command events
- Communication Manager → Speech Output: speaks messages
- Human → Watch Interface: selects response
- Watch Interface → Watch Server: sends permission
- Watch Server → Event Queue: queues response
- Task Manager → GH Dispatcher: dispatches task
- GH Dispatcher → UDP Sender: sends task data
- UDP Sender → Grasshopper: sends task id and piece
- Task Manager → ROS Communication: publishes controls
- ROS Communication → Robot / UR: controls runtime
- Robot / UR → ROS Communication: reports success
- ROS Communication → Event Queue: queues success event
- UR Control → Robot / UR: controls arm
- Robot / UR → UR State Reader: provides state
- Task Manager → Event Logger: logs transitions
