# dlekgns145-hue/robot_project architecture

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

- Interactive diagram: https://gitdiagram.com/dlekgns145-hue/robot_project
- Repository: https://github.com/dlekgns145-hue/robot_project

## Overview

This repository combines a ROS 2 mobile-robot system with desktop control and mapping tools, plus a separate orchard-visual-mapping package and apple-image analysis tools. The principal workflow is selecting a robot mode: perception detects and publishes a person, follow converts detections into motion commands, or navigation sends a goal to Nav2. A second major workflow autonomously explores and saves a LiDAR map for desktop transfer and postprocessing. Several links are based on README or source-index references; unsampled implementations are not inferred beyond those references.

Main entry points: [`ubuntu_v2/robot_app/robot_gateway.py`](https://github.com/dlekgns145-hue/robot_project/blob/main/ubuntu_v2/robot_app/robot_gateway.py) (Desktop gateway), [`robot_project/main.py`](https://github.com/dlekgns145-hue/robot_project/blob/main/robot_project/main.py) (Mode runner), [`robot_docker/autonomous_mapping.py`](https://github.com/dlekgns145-hue/robot_project/blob/main/robot_docker/autonomous_mapping.py) (Autonomous mapping), [`robot_project/follow/follow_person.py`](https://github.com/dlekgns145-hue/robot_project/blob/main/robot_project/follow/follow_person.py) (Person following)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_robot["Robot behavior"]
  node_runner["Mode runner<br/>[main.py]"]
  node_mode_rules["Mode rules<br/>[runtime.py]"]
  node_perception["Person detection<br/>[detect.py]"]
  node_following["Person following<br/>[follow_person.py]"]
  node_navigation["Nav goal<br/>[nav.py]"]
  node_docker_perception["Identity-aware detection<br/>[detect.py]"]
  node_identity["Target identity<br/>[target_identity.py]"]
  node_command_bridge["Robot command bridge"]
  node_robot_service["Robot service<br/>[robot_service.py]"]
end

subgraph group_mapping["Mapping and maps"]
  node_mapping_runtime["Autonomous mapping"]
  node_frontier["Frontier exploration<br/>[frontier_core.py]"]
  node_mapping_core["SLAM mapping core<br/>[mapping_core.py]"]
  node_map_bundle["Map bundle<br/>[map_bundle.py]"]
end

subgraph group_desktop["Desktop control"]
  node_gateway["Desktop gateway<br/>[robot_gateway.py]"]
  node_locator["Robot locator<br/>[robot_locator.py]"]
  node_inbox["Map inbox<br/>[map_inbox.py]"]
  node_payload["Map payload<br/>[map_payload.py]"]
  node_postprocess["Map postprocessing<br/>[map_postprocess.py]"]
  node_operations[("Operations state")]
end

subgraph group_visual["Visual mapping and analysis"]
  node_visual_mapper["Visual map mosaic"]
  node_frame_db[("Frame database<br/>[frame_database.py]")]
  node_coordinates["Coordinate transforms"]
  node_apple_analysis["Apple defect analysis<br/>[analyze_image.py]"]
end

node_operator(("Operator"))

node_operator -->|"selects mode"| node_runner
node_runner -->|"gets components"| node_mode_rules
node_runner -->|"starts"| node_perception
node_runner -->|"starts"| node_following
node_runner -->|"starts"| node_navigation
node_perception -->|"publishes detections"| node_following
node_following -.->|"commands motion"| node_operator
node_navigation -->|"sends Nav2 goal"| node_operator
node_docker_perception -->|"uses gallery"| node_identity
node_mapping_runtime -->|"uses exploration"| node_frontier
node_mapping_runtime -->|"uses mapping"| node_mapping_core
node_mapping_runtime -.->|"saves map"| node_map_bundle
node_command_bridge -->|"uses bundle"| node_map_bundle
node_operator -->|"sends commands"| node_gateway
node_gateway -.->|"relays commands"| node_robot_service
node_gateway -->|"resolves robot"| node_locator
node_gateway -->|"checks map transfer"| node_inbox
node_gateway -->|"prepares map"| node_payload
node_gateway -->|"updates state"| node_operations
node_gateway -.->|"offers correction"| node_postprocess
node_visual_mapper -->|"stores frames"| node_frame_db
node_visual_mapper -->|"uses transforms"| node_coordinates

click node_runner "https://github.com/dlekgns145-hue/robot_project/blob/main/robot_project/main.py"
click node_mode_rules "https://github.com/dlekgns145-hue/robot_project/blob/main/robot_project/runtime.py"
click node_perception "https://github.com/dlekgns145-hue/robot_project/blob/main/robot_project/perception/detect.py"
click node_following "https://github.com/dlekgns145-hue/robot_project/blob/main/robot_project/follow/follow_person.py"
click node_navigation "https://github.com/dlekgns145-hue/robot_project/blob/main/robot_project/navigation/nav.py"
click node_docker_perception "https://github.com/dlekgns145-hue/robot_project/blob/main/robot_docker/perception/detect.py"
click node_identity "https://github.com/dlekgns145-hue/robot_project/blob/main/robot_docker/perception/target_identity.py"
click node_mapping_runtime "https://github.com/dlekgns145-hue/robot_project/blob/main/robot_docker/autonomous_mapping.py"
click node_frontier "https://github.com/dlekgns145-hue/robot_project/blob/main/robot_docker/frontier_core.py"
click node_mapping_core "https://github.com/dlekgns145-hue/robot_project/blob/main/robot_docker/mapping_core.py"
click node_map_bundle "https://github.com/dlekgns145-hue/robot_project/blob/main/robot_docker/map_bundle.py"
click node_command_bridge "https://github.com/dlekgns145-hue/robot_project/blob/main/robot_docker/robot_cmd_bridge.py"
click node_gateway "https://github.com/dlekgns145-hue/robot_project/blob/main/ubuntu_v2/robot_app/robot_gateway.py"
click node_robot_service "https://github.com/dlekgns145-hue/robot_project/blob/main/ubuntu_v2/robot_app/robot_service.py"
click node_locator "https://github.com/dlekgns145-hue/robot_project/blob/main/ubuntu_v2/robot_app/robot_locator.py"
click node_inbox "https://github.com/dlekgns145-hue/robot_project/blob/main/ubuntu_v2/robot_app/map_inbox.py"
click node_payload "https://github.com/dlekgns145-hue/robot_project/blob/main/ubuntu_v2/robot_app/map_payload.py"
click node_postprocess "https://github.com/dlekgns145-hue/robot_project/blob/main/ubuntu_v2/robot_app/map_postprocess.py"
click node_operations "https://github.com/dlekgns145-hue/robot_project/blob/main/ubuntu_v2/robot_app/operations_store.py"
click node_visual_mapper "https://github.com/dlekgns145-hue/robot_project/blob/main/orchard_mapper/orchard_mapper/global_visual_mapper.py"
click node_frame_db "https://github.com/dlekgns145-hue/robot_project/blob/main/orchard_mapper/orchard_mapper/frame_database.py"
click node_coordinates "https://github.com/dlekgns145-hue/robot_project/blob/main/orchard_mapper/orchard_mapper/coordinate_transform.py"
click node_apple_analysis "https://github.com/dlekgns145-hue/robot_project/blob/main/apple_defect_detection/scripts/analyze_image.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_runner,node_mode_rules,node_perception,node_following,node_navigation,node_docker_perception,node_identity,node_command_bridge,node_robot_service toneBlue
class node_mapping_runtime,node_frontier,node_mapping_core,node_map_bundle toneAmber
class node_gateway,node_locator,node_inbox,node_payload,node_postprocess,node_operations toneMint
class node_visual_mapper,node_frame_db,node_coordinates,node_apple_analysis toneRose
class node_operator toneIndigo
```

## Components

### Robot behavior

- [Mode runner](https://github.com/dlekgns145-hue/robot_project/blob/main/robot_project/main.py): `robot_project/main.py`
- [Mode rules](https://github.com/dlekgns145-hue/robot_project/blob/main/robot_project/runtime.py): `robot_project/runtime.py`
- [Person detection](https://github.com/dlekgns145-hue/robot_project/blob/main/robot_project/perception/detect.py): `robot_project/perception/detect.py`
- [Person following](https://github.com/dlekgns145-hue/robot_project/blob/main/robot_project/follow/follow_person.py): `robot_project/follow/follow_person.py`
- [Nav goal](https://github.com/dlekgns145-hue/robot_project/blob/main/robot_project/navigation/nav.py): `robot_project/navigation/nav.py`
- [Identity-aware detection](https://github.com/dlekgns145-hue/robot_project/blob/main/robot_docker/perception/detect.py): `robot_docker/perception/detect.py`
- [Target identity](https://github.com/dlekgns145-hue/robot_project/blob/main/robot_docker/perception/target_identity.py): `robot_docker/perception/target_identity.py`
- [Robot command bridge](https://github.com/dlekgns145-hue/robot_project/blob/main/robot_docker/robot_cmd_bridge.py): `robot_docker/robot_cmd_bridge.py`
- [Robot service](https://github.com/dlekgns145-hue/robot_project/blob/main/ubuntu_v2/robot_app/robot_service.py): `ubuntu_v2/robot_app/robot_service.py`

### Mapping and maps

- [Autonomous mapping](https://github.com/dlekgns145-hue/robot_project/blob/main/robot_docker/autonomous_mapping.py): `robot_docker/autonomous_mapping.py`
- [Frontier exploration](https://github.com/dlekgns145-hue/robot_project/blob/main/robot_docker/frontier_core.py): `robot_docker/frontier_core.py`
- [SLAM mapping core](https://github.com/dlekgns145-hue/robot_project/blob/main/robot_docker/mapping_core.py): `robot_docker/mapping_core.py`
- [Map bundle](https://github.com/dlekgns145-hue/robot_project/blob/main/robot_docker/map_bundle.py): `robot_docker/map_bundle.py`

### Desktop control

- [Desktop gateway](https://github.com/dlekgns145-hue/robot_project/blob/main/ubuntu_v2/robot_app/robot_gateway.py): `ubuntu_v2/robot_app/robot_gateway.py`
- [Robot locator](https://github.com/dlekgns145-hue/robot_project/blob/main/ubuntu_v2/robot_app/robot_locator.py): `ubuntu_v2/robot_app/robot_locator.py`
- [Map inbox](https://github.com/dlekgns145-hue/robot_project/blob/main/ubuntu_v2/robot_app/map_inbox.py): `ubuntu_v2/robot_app/map_inbox.py`
- [Map payload](https://github.com/dlekgns145-hue/robot_project/blob/main/ubuntu_v2/robot_app/map_payload.py): `ubuntu_v2/robot_app/map_payload.py`
- [Map postprocessing](https://github.com/dlekgns145-hue/robot_project/blob/main/ubuntu_v2/robot_app/map_postprocess.py): `ubuntu_v2/robot_app/map_postprocess.py`
- [Operations state](https://github.com/dlekgns145-hue/robot_project/blob/main/ubuntu_v2/robot_app/operations_store.py): `ubuntu_v2/robot_app/operations_store.py`

### Visual mapping and analysis

- [Visual map mosaic](https://github.com/dlekgns145-hue/robot_project/blob/main/orchard_mapper/orchard_mapper/global_visual_mapper.py): `orchard_mapper/orchard_mapper/global_visual_mapper.py`
- [Frame database](https://github.com/dlekgns145-hue/robot_project/blob/main/orchard_mapper/orchard_mapper/frame_database.py): `orchard_mapper/orchard_mapper/frame_database.py`
- [Coordinate transforms](https://github.com/dlekgns145-hue/robot_project/blob/main/orchard_mapper/orchard_mapper/coordinate_transform.py): `orchard_mapper/orchard_mapper/coordinate_transform.py`
- [Apple defect analysis](https://github.com/dlekgns145-hue/robot_project/blob/main/apple_defect_detection/scripts/analyze_image.py): `apple_defect_detection/scripts/analyze_image.py`

### Other components

- **Operator**

## Connections

- Operator → Mode runner: selects mode
- Mode runner → Mode rules: gets components (evidence: `robot_project/main.py`)
- Mode runner → Person detection: starts (evidence: `robot_project/main.py`)
- Mode runner → Person following: starts (evidence: `robot_project/main.py`)
- Mode runner → Nav goal: starts (evidence: `robot_project/main.py`)
- Person detection → Person following: publishes detections
- Person following → Operator: commands motion
- Nav goal → Operator: sends Nav2 goal (evidence: `robot_project/navigation/nav.py`)
- Identity-aware detection → Target identity: uses gallery (evidence: `robot_docker/perception/detect.py`)
- Autonomous mapping → Frontier exploration: uses exploration (evidence: `robot_docker/autonomous_mapping.py`)
- Autonomous mapping → SLAM mapping core: uses mapping (evidence: `robot_docker/autonomous_mapping.py`)
- Autonomous mapping → Map bundle: saves map
- Robot command bridge → Map bundle: uses bundle (evidence: `robot_docker/robot_cmd_bridge.py`)
- Operator → Desktop gateway: sends commands
- Desktop gateway → Robot service: relays commands
- Desktop gateway → Robot locator: resolves robot (evidence: `ubuntu_v2/robot_app/robot_gateway.py`)
- Desktop gateway → Map inbox: checks map transfer (evidence: `ubuntu_v2/robot_app/robot_gateway.py`)
- Desktop gateway → Map payload: prepares map (evidence: `ubuntu_v2/robot_app/robot_gateway.py`)
- Desktop gateway → Operations state: updates state (evidence: `ubuntu_v2/robot_app/robot_gateway.py`)
- Desktop gateway → Map postprocessing: offers correction
- Visual map mosaic → Frame database: stores frames (evidence: `orchard_mapper/orchard_mapper/global_visual_mapper.py`)
- Visual map mosaic → Coordinate transforms: uses transforms (evidence: `orchard_mapper/orchard_mapper/global_visual_mapper.py`)
