# roborregos/home2 architecture

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

- Interactive diagram: https://gitdiagram.com/roborregos/home2
- Repository: https://github.com/roborregos/home2

## Overview

1. **Repository shape and runtime model**
   - This is a ROS 2 robot system for FRIDA, organized as a set of area-specific workspaces/packages rather than a single monolith.
   - The main operational boundaries are **vision**, **navigation**, **manipulation**, **HRI**, and a top-level **task manager** that coordinates them.
   - Deployment is container-first: `run.sh` selects CPU/CUDA/L4T variants and starts area-specific Docker Compose stacks.

2. **Shared contract layer**
   - `frida_interfaces` is the central API boundary: it defines the ROS 2 messages, services, and actions used between subsystems.
   - It contains separate interface namespaces for HRI, manipulation, navigation, vision, and task manager-related services.
   - `frida_constants` holds shared vocabularies and configuration data such as object lists, names, map area definitions, and robot-specific constants used across packages.

3. **Task orchestration layer**
   - `task_manager` is the high-level coordinator for competition routines and multi-step behaviors like GPSR, receptionist, storing groceries, carrying, and restaurant tasks.
   - It decomposes tasks into subtasks and delegates to the navigation, vision, manipulation, and HRI stacks through the shared interfaces.
   - This package is the main “application logic” boundary: it does not implement perception or control itself, but sequences the specialized subsystems.

4. **Human-robot interaction stack**
   - `hri` contains the speech and dialog subsystem, including wake-word listening, voice activity detection, streaming speech-to-text, text-to-speech, and NLP utilities.
   - It also includes a web-based display app (`hri/packages/display`) that serves as the operator-facing UI and ROS client.
   - The HRI stack is backed by microservices and external service components such as STT/TTS, an LLM/Ollama-based backend, and PostgreSQL-backed embeddings/knowledge retrieval.

5. **HRI data path**
   - Audio enters through the speech package, passes through capture/voice-detection/KWS components, then to STT and NLP services.
   - Extracted intent, answers, and command interpretation flow back through task manager interfaces to trigger robot actions.
   - Responses are sent to TTS and also surfaced in the display UI, which acts as a monitoring and interaction front-end.

6. **Vision subsystem**
   - `vision` provides the perception stack: object detection, zero-shot detection, person/face tracking, pointing detection, QR reading, shelf/customer/trash/dishwasher-specific detections, and 3D helpers.
   - It mixes Python nodes with some performance-sensitive components and model assets, including specialized detector configurations and weights.
   - `vision/packages/moondream_run` adds a separate generative-vision service path, exposed via its own proto-based server/client wrapper.

7. **Vision data path**
   - Camera and depth sensor feeds are processed into detections, tracks, and semantic annotations that are consumed by task manager and downstream behaviors.
   - The outputs are domain-specific ROS messages and services like person lists, object arrays, shelf detections, and detection handlers.
   - Vision is also used to prepare scene understanding for manipulation and for human-following / interaction tasks.

8. **Navigation subsystem**
   - `navigation` contains the mobile base driver, map context service, and Nav2/RTAB-Map integration.
   - `nav_main` is the control hub for navigation behaviors; it includes behavior-tree configs, monitoring, and task launch files for mapping and general navigation.
   - `dashgo_driver` provides the base hardware interface, while `map_context` manages semantic area maps and area-tagging utilities.

9. **Navigation data path**
   - Low-level odometry/driver data flows into localization and navigation planners.
   - Map context augments geometric navigation with room/area semantics, which task manager uses to route the robot to task-relevant locations.
   - The navigation stack is designed to support both autonomous navigation and teleoperation / control tooling.

10. **Manipulation subsystem**
   - `manipulation` covers the arm, gripper, grasp perception, and motion planning stack around the xArm-based manipulator.
   - It includes MoveIt-based planning, servo/control utilities, ikfast plugin support, pick-and-place managers, and 3D perception components for grasping and docking.
   - There are clear layers here: hardware/robot description, motion planning, grasp estimation, and task-level pick/place/pour workflows.

11. **Manipulation data path**
   - Perception results from vision and 3D point cloud processing feed grasp and placement planning.
   - The manipulation layer converts task requests into motion plans, servo commands, collision objects, and execution actions on the arm.
   - Specialized flows exist for pick, place, pour, handle docking, and trajectory/playback operations.

12. **Robot model and simulation boundary**
   - `robot_description/frida_description` is the shared physical model of the whole robot: mobile base, xArm, gripper variants, ZED camera, lidar, wheels, and simulation assets.
   - It provides URDF/Xacro, SRDF, and world files used by navigation, manipulation, visualization, and simulation launch files.
   - This package is the canonical source for kinematics, TF structure, and robot-specific geometry.

13. **Deployment and environment management**
   - The repository is heavily infrastructure-driven: Dockerfiles and Compose files exist per subsystem and per hardware target.
   - `cyclonedds.xml`, `setup_cyclonedds.sh`, and the `status/` configs show that multi-machine ROS 2 communication and node health monitoring are part of the architecture.
   - CI workflows cover ROS 2 builds, pre-commit checks, Doxygen docs, submodule validation, and Docker publishing.

14. **Typical system-level flow**
   - Human input or a task command enters through HRI or task manager.
   - Task manager decides the required sequence and invokes navigation to reach a location, vision to perceive the scene, and manipulation to interact with objects.
   - Results are summarized back through HRI/display, with shared interfaces and constants keeping the subsystems loosely coupled but interoperable.

Main entry points: [`task_manager/task_manager`](https://github.com/roborregos/home2/tree/main/task_manager/task_manager) (Task manager), [`navigation/packages/nav_main`](https://github.com/roborregos/home2/tree/main/navigation/packages/nav_main) (Nav core), [`frida_interfaces`](https://github.com/roborregos/home2/tree/main/frida_interfaces) (Interfaces), [`run.sh`](https://github.com/roborregos/home2/blob/main/run.sh) (Run script)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_platform["Platform"]
  node_run_sh["Run script<br/>container entrypoint<br/>[run.sh]"]
  node_docker_hri["HRI compose<br/>docker stack"]
  node_docker_nav["Nav compose<br/>docker stack"]
  node_docker_vis["Vision compose<br/>docker stack"]
  node_docker_man["Manip compose<br/>docker stack"]
  node_frida_desc["Robot model<br/>robot description"]
end

subgraph group_contracts["Contracts"]
  node_interfaces[("Interfaces<br/>ROS 2 API")]
  node_constants[("Constants<br/>shared vocab")]
end

subgraph group_orchestration["Orchestration"]
  node_task_mgr["Task manager<br/>orchestrator"]
  node_task_launch["Task launch<br/>task entrypoints"]
end

subgraph group_hri["HRI"]
  node_speech["Speech<br/>audio pipeline"]
  node_nlp["NLP<br/>dialog services"]
  node_embeddings["Embeddings<br/>knowledge store"]
  node_display["Display UI<br/>web client"]
end

subgraph group_vision["Vision"]
  node_vision_main["Vision core<br/>perception stack"]
  node_moondream["Moondream<br/>gen-vision service"]
end

subgraph group_navigation["Navigation"]
  node_nav_main["Nav core<br/>navigation hub"]
  node_map_context["Map context<br/>semantic maps"]
  node_dashgo["Base driver<br/>mobile base"]
end

subgraph group_manipulation["Manipulation"]
  node_arm_pkg["Arm model<br/>robot arm config"]
  node_motion_planning["Planner<br/>arm planning"]
  node_pick_place["Pick/place<br/>task skills"]
  node_perception_3d["3D perception<br/>grasp perception"]
end

node_run_sh -->|"starts"| node_docker_hri
node_run_sh -->|"starts"| node_docker_nav
node_run_sh -->|"starts"| node_docker_vis
node_run_sh -->|"starts"| node_docker_man
node_task_mgr -->|"uses"| node_interfaces
node_task_mgr -->|"uses"| node_constants
node_task_mgr -->|"delegates"| node_speech
node_task_mgr -->|"delegates"| node_nlp
node_task_mgr -->|"delegates"| node_vision_main
node_task_mgr -->|"delegates"| node_nav_main
node_task_mgr -->|"delegates"| node_pick_place
node_speech -->|"queries"| node_embeddings
node_nlp -->|"queries"| node_embeddings
node_display -->|"monitors"| node_speech
node_display -->|"controls"| node_task_mgr
node_vision_main -->|"publishes"| node_interfaces
node_vision_main -.->|"extends"| node_moondream
node_nav_main -->|"uses"| node_map_context
node_nav_main -->|"drives"| node_dashgo
node_nav_main -->|"publishes"| node_interfaces
node_motion_planning -->|"configures"| node_arm_pkg
node_pick_place -->|"executes"| node_motion_planning
node_pick_place -->|"uses"| node_perception_3d
node_perception_3d -->|"serves"| node_interfaces
node_frida_desc -.->|"supports"| node_nav_main
node_frida_desc -.->|"supports"| node_motion_planning
node_frida_desc -.->|"supports"| node_vision_main
node_interfaces -.->|"binds"| node_task_mgr
node_constants -.->|"supplies"| node_map_context

click node_run_sh "https://github.com/roborregos/home2/blob/main/run.sh"
click node_docker_hri "https://github.com/roborregos/home2/blob/main/docker/hri/compose/docker-compose-cpu.yml"
click node_docker_nav "https://github.com/roborregos/home2/blob/main/docker/navigation/docker-compose.yaml"
click node_docker_vis "https://github.com/roborregos/home2/blob/main/docker/vision/docker-compose.yaml"
click node_docker_man "https://github.com/roborregos/home2/blob/main/docker/manipulation/docker-compose-cpu.yaml"
click node_frida_desc "https://github.com/roborregos/home2/tree/main/robot_description/frida_description"
click node_interfaces "https://github.com/roborregos/home2/tree/main/frida_interfaces"
click node_constants "https://github.com/roborregos/home2/tree/main/frida_constants"
click node_task_mgr "https://github.com/roborregos/home2/tree/main/task_manager/task_manager"
click node_task_launch "https://github.com/roborregos/home2/tree/main/task_manager/launch"
click node_speech "https://github.com/roborregos/home2/tree/main/hri/packages/speech"
click node_nlp "https://github.com/roborregos/home2/tree/main/hri/packages/nlp"
click node_embeddings "https://github.com/roborregos/home2/tree/main/hri/packages/embeddings"
click node_display "https://github.com/roborregos/home2/tree/main/hri/packages/display"
click node_vision_main "https://github.com/roborregos/home2/tree/main/vision/packages/vision_general"
click node_moondream "https://github.com/roborregos/home2/tree/main/vision/packages/moondream_run"
click node_nav_main "https://github.com/roborregos/home2/tree/main/navigation/packages/nav_main"
click node_map_context "https://github.com/roborregos/home2/tree/main/navigation/packages/map_context"
click node_dashgo "https://github.com/roborregos/home2/tree/main/navigation/packages/dashgo_driver"
click node_arm_pkg "https://github.com/roborregos/home2/tree/main/manipulation/packages/arm_pkg"
click node_motion_planning "https://github.com/roborregos/home2/tree/main/manipulation/packages/frida_motion_planning"
click node_pick_place "https://github.com/roborregos/home2/tree/main/manipulation/packages/pick_and_place"
click node_perception_3d "https://github.com/roborregos/home2/tree/main/manipulation/packages/perception_3d"

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_run_sh,node_docker_hri,node_docker_nav,node_docker_vis,node_docker_man,node_frida_desc,node_arm_pkg,node_motion_planning,node_pick_place,node_perception_3d toneBlue
class node_interfaces,node_constants toneAmber
class node_task_mgr,node_task_launch toneMint
class node_speech,node_nlp,node_embeddings,node_display toneRose
class node_vision_main,node_moondream toneIndigo
class node_nav_main,node_map_context,node_dashgo toneTeal
```

## Components

### Platform

Deployment, runtime, and shared robot model

- [Run script](https://github.com/roborregos/home2/blob/main/run.sh): container entrypoint · Selects hardware/runtime variants and starts area-specific stacks · `run.sh`
- [HRI compose](https://github.com/roborregos/home2/blob/main/docker/hri/compose/docker-compose-cpu.yml): docker stack · Container stack for speech, NLP, embeddings, database, and display · `docker/hri/compose/docker-compose-cpu.yml`
- [Nav compose](https://github.com/roborregos/home2/blob/main/docker/navigation/docker-compose.yaml): docker stack · Container stack for navigation runtime · `docker/navigation/docker-compose.yaml`
- [Vision compose](https://github.com/roborregos/home2/blob/main/docker/vision/docker-compose.yaml): docker stack · Container stack for perception runtime and variants · `docker/vision/docker-compose.yaml`
- [Manip compose](https://github.com/roborregos/home2/blob/main/docker/manipulation/docker-compose-cpu.yaml): docker stack · Container stack for arm planning and manipulation runtime · `docker/manipulation/docker-compose-cpu.yaml`
- [Robot model](https://github.com/roborregos/home2/tree/main/robot_description/frida_description): robot description · Canonical URDF/SRDF and simulation assets for the full robot · `robot_description/frida_description`

### Contracts

Shared interfaces and constants

- [Interfaces](https://github.com/roborregos/home2/tree/main/frida_interfaces): ROS 2 API · Shared messages, services, and actions across subsystems · `frida_interfaces`
- [Constants](https://github.com/roborregos/home2/tree/main/frida_constants): shared vocab · Object lists, map areas, robot constants, and configuration data · `frida_constants`

### Orchestration

Top-level task coordination

- [Task manager](https://github.com/roborregos/home2/tree/main/task_manager/task_manager): orchestrator · High-level coordinator for competition tasks and multi-step behaviors · `task_manager/task_manager`
- [Task launch](https://github.com/roborregos/home2/tree/main/task_manager/launch): task entrypoints · Task-specific launch wrappers for competition routines · `task_manager/launch`

### HRI

Speech, dialog, embeddings, and display

- [Speech](https://github.com/roborregos/home2/tree/main/hri/packages/speech): audio pipeline · Wake word, VAD, audio capture, streaming STT, and TTS front-end · `hri/packages/speech`
- [NLP](https://github.com/roborregos/home2/tree/main/hri/packages/nlp): dialog services · Command interpretation, extraction, LLM utilities, and dialog logic · `hri/packages/nlp`
- [Embeddings](https://github.com/roborregos/home2/tree/main/hri/packages/embeddings): knowledge store · PostgreSQL-backed embeddings and knowledge retrieval services · `hri/packages/embeddings`
- [Display UI](https://github.com/roborregos/home2/tree/main/hri/packages/display): web client · Operator-facing web app and ROS client for interaction and monitoring · `hri/packages/display`

### Vision

Perception and scene understanding

- [Vision core](https://github.com/roborregos/home2/tree/main/vision/packages/vision_general): perception stack · Object detection, tracking, pointing, face/person, QR, and domain detectors · `vision/packages/vision_general`
- [Moondream](https://github.com/roborregos/home2/tree/main/vision/packages/moondream_run): gen-vision service · Proto-based generative vision server/client path · `vision/packages/moondream_run`

### Navigation

Mobile base control and map semantics

- [Nav core](https://github.com/roborregos/home2/tree/main/navigation/packages/nav_main): navigation hub · Nav2/RTAB-Map integration, behaviors, monitoring, and task launchers · `navigation/packages/nav_main`
- [Map context](https://github.com/roborregos/home2/tree/main/navigation/packages/map_context): semantic maps · Area tagging and semantic map service for routing and locations · `navigation/packages/map_context`
- [Base driver](https://github.com/roborregos/home2/tree/main/navigation/packages/dashgo_driver): mobile base · Hardware interface and odometry/driver layer for the robot base · `navigation/packages/dashgo_driver`

### Manipulation

Arm planning, grasping, and pick/place

- [Arm model](https://github.com/roborregos/home2/tree/main/manipulation/packages/arm_pkg): robot arm config · xArm robot model, MoveIt config builder, and driver launch · `manipulation/packages/arm_pkg`
- [Planner](https://github.com/roborregos/home2/tree/main/manipulation/packages/frida_motion_planning): arm planning · MoveIt planning, servo utilities, and motion-planning server · `manipulation/packages/frida_motion_planning`
- [Pick/place](https://github.com/roborregos/home2/tree/main/manipulation/packages/pick_and_place): task skills · Pick, place, and pour managers and execution servers · `manipulation/packages/pick_and_place`
- [3D perception](https://github.com/roborregos/home2/tree/main/manipulation/packages/perception_3d): grasp perception · Point-cloud processing, docking, primitives, and grasp estimation · `manipulation/packages/perception_3d`

## Connections

- Run script → HRI compose: starts · Launches the HRI container stack
- Run script → Nav compose: starts · Launches the navigation container stack
- Run script → Vision compose: starts · Launches the vision container stack
- Run script → Manip compose: starts · Launches the manipulation container stack
- Task manager → Interfaces: uses · Consumes shared ROS interfaces for cross-stack coordination
- Task manager → Constants: uses · Reads shared object names, areas, and robot vocabularies
- Task manager → Speech: delegates · Uses speech and dialog services for HRI-driven tasks
- Task manager → NLP: delegates · Uses command interpretation and extraction services
- Task manager → Vision core: delegates · Requests perception, detection, and tracking capabilities
- Task manager → Nav core: delegates · Commands navigation and monitoring behaviors
- Task manager → Pick/place: delegates · Invokes manipulation workflows for action tasks
- Speech → Embeddings: queries · Uses knowledge retrieval and stored embeddings
- NLP → Embeddings: queries · Uses retrieval-backed dialog and categorization
- Display UI → Speech: monitors · Surfaces interaction state and operator feedback
- Display UI → Task manager: controls · Acts as a front-end for task initiation and status
- Vision core → Interfaces: publishes · Exports detections, person lists, shelf arrays, and handlers
- Vision core → Moondream: extends · Adds an alternate generative-vision service path
- Nav core → Map context: uses · Augments navigation with semantic area maps
- Nav core → Base driver: drives · Uses the base driver for low-level motion and odometry
- Nav core → Interfaces: publishes · Shares movement and monitor interfaces
- Planner → Arm model: configures · Builds on the arm description and MoveIt setup
- Pick/place → Planner: executes · Calls planning and servo services for manipulation tasks
- Pick/place → 3D perception: uses · Consumes 3D grasp and docking perception
- 3D perception → Interfaces: serves · Exposes grasp, plane, and docking services
- Robot model → Nav core: supports · Provides TF, geometry, and robot model data for navigation
- Robot model → Planner: supports · Provides kinematic model and collision geometry for planning
- Robot model → Vision core: supports · Provides camera and robot frame context for perception
- Interfaces → Task manager: binds · Defines the task manager service boundary
- Constants → Map context: supplies · Provides map area and robot-specific constants
