# laiyuzhi/fam-hri architecture

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

- Interactive diagram: https://gitdiagram.com/laiyuzhi/fam-hri
- Repository: https://github.com/laiyuzhi/fam-hri

## Overview

##### Project type and purpose
- From the file tree and README, this is a ROS‑style robotics research package (“Aria_pkg”) for Familiarity‑Aware Human‑Robot Interaction (FAM‑HRI).
- It integrates real‑time sensor streaming (images, audio), machine‑learning inference (eye‐tracking), and a GPT API for context‑aware interaction.

##### File structure
- Top‑level ROS package:
- Aria_pkg/CMakeLists.txt & package.xml → defines a ROS/CMake project.
- src/ → all Python modules and ROS nodes.
- Key components under src/:
- streaming_start.py → launch or orchestration node.
- streaming_publish_image.py → image publisher node (camera → ROS topic).
- streaming_audio_control.py → audio input/output node.
- projectaria_eyetracking/real_time_inference.py → inference node subscribing to image topics, producing gaze estimates.
- gpt_api.py → client for calls to a GPT‐style conversational API.
- Inference internals in projectaria_eyetracking/inference/model → backbone, head, model_utils, model architectures. Data loader in inference/data/data.py.

##### README for additional insights
- The system’s goal is to sense human familiarity cues (via eye‐tracking), process them in real time, and generate robot responses (via audio and GPT).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Sensors
    subgraph "Sensors" 
        direction TB
        Camera["Camera"]:::sensor
        Microphone["Microphone"]:::sensor
    end

    %% Streaming Layer
    subgraph "Streaming Nodes"
        direction TB
        PubImage["Image Publisher\n(streaming_publish_image)"]:::streaming
        AudioCtrl["Audio Control Node\n(streaming_audio_control)"]:::actuation
        Orchestrator["Orchestrator\n(streaming_start)"]:::streaming
    end

    %% ROS Topics
    Camera -->|"real-time /camera/image_raw"| PubImage
    Microphone -->|"audio input"| AudioCtrl

    %% Inference Node
    PubImage -->|"/camera/image_raw"| Inference["Inference Node\n(real_time_inference)"]:::inference
    subgraph "Inference Internals"
        direction TB
        DataLoader["Data Loader\n(data.py)"]:::ml
        Backbone["Model Backbone\n(backbone.py)"]:::ml
        Head["Model Head\n(head.py)"]:::ml
        CoreModel["Core Model\n(model.py)"]:::ml
        Archs["Model Archs\n(model_archs.py)"]:::ml
        Utils["Model Utils\n(model_utils.py)"]:::ml
    end
    Inference --> DataLoader
    DataLoader --> Backbone
    Backbone --> Head
    Head --> CoreModel
    CoreModel --> Archs
    Archs --> Utils
    Utils --> Inference

    %% Gaze topic to Orchestrator
    Inference -->|"gaze_estimate topic"| Orchestrator

    %% GPT Client
    Orchestrator -->|"calls GPT"| GPTClient["GPT Client Node\ngpt_api"]:::external
    GPTClient -->|"POST /chat"| ExternalAPI["External GPT API"]:::service
    ExternalAPI -->|"response text"| AudioCtrl

    %% ROS Package Definition (clickable)
    PackageDef["ROS Package Definition\n(CMakeLists.txt, package.xml)"]:::meta

    %% Connections to PackageDef
    PackageDef -.-> PubImage
    PackageDef -.-> AudioCtrl
    PackageDef -.-> Inference
    PackageDef -.-> GPTClient

    %% Click events
    click PackageDef "https://github.com/laiyuzhi/fam-hri/blob/main/Aria_pkg/CMakeLists.txt"
    click PackageDef "https://github.com/laiyuzhi/fam-hri/blob/main/Aria_pkg/package.xml"
    click Orchestrator "https://github.com/laiyuzhi/fam-hri/blob/main/Aria_pkg/src/streaming_start.py"
    click PubImage "https://github.com/laiyuzhi/fam-hri/blob/main/Aria_pkg/src/streaming_publish_image.py"
    click AudioCtrl "https://github.com/laiyuzhi/fam-hri/blob/main/Aria_pkg/src/streaming_audio_control.py"
    click GPTClient "https://github.com/laiyuzhi/fam-hri/blob/main/Aria_pkg/src/gpt_api.py"
    click Inference "https://github.com/laiyuzhi/fam-hri/blob/main/Aria_pkg/src/projectaria_eyetracking/projectaria_eyetracking/real_time_inference.py"
    click DataLoader "https://github.com/laiyuzhi/fam-hri/blob/main/Aria_pkg/src/projectaria_eyetracking/projectaria_eyetracking/inference/data/data.py"
    click Backbone "https://github.com/laiyuzhi/fam-hri/blob/main/Aria_pkg/src/projectaria_eyetracking/projectaria_eyetracking/inference/model/backbone.py"
    click Head "https://github.com/laiyuzhi/fam-hri/blob/main/Aria_pkg/src/projectaria_eyetracking/projectaria_eyetracking/inference/model/head.py"
    click CoreModel "https://github.com/laiyuzhi/fam-hri/blob/main/Aria_pkg/src/projectaria_eyetracking/projectaria_eyetracking/inference/model/model.py"
    click Archs "https://github.com/laiyuzhi/fam-hri/blob/main/Aria_pkg/src/projectaria_eyetracking/projectaria_eyetracking/inference/model/model_archs.py"
    click Utils "https://github.com/laiyuzhi/fam-hri/blob/main/Aria_pkg/src/projectaria_eyetracking/projectaria_eyetracking/inference/model/model_utils.py"
    click Orchestrator "https://github.com/laiyuzhi/fam-hri/blob/main/Aria_pkg/src/projectaria_eyetracking/setup.py"

    %% Styles
    classDef sensor fill:#AED6F1,stroke:#1B4F72,color:#1B2631
    classDef streaming fill:#85C1E9,stroke:#1B4F72,color:#1B2631
    classDef inference fill:#ABEBC6,stroke:#186A3B,color:#1B2631
    classDef ml fill:#82E0AA,stroke:#196F3D,color:#1B2631
    classDef external fill:#F9E79F,stroke:#B9770E,color:#1B2631
    classDef service fill:#F5CBA7,stroke:#7E5109,color:#1B2631
    classDef actuation fill:#F7DC6F,stroke:#B7950B,color:#1B2631
    classDef meta fill:#D7BDE2,stroke:#512E5F,color:#1B2631
```
