# mi1nn/overwatch-amr architecture

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

- Interactive diagram: https://gitdiagram.com/mi1nn/overwatch-amr
- Repository: https://github.com/mi1nn/overwatch-amr

## Overview

Overwatch AMR is a ROS 2 system that locates an RC car with a fixed webcam, approaches it with TurtleBot4/Nav2, then follows it using the robot’s RGB-depth camera and searches when it is lost. The main runtime spans vision, coordinate calibration, and robot control; the README also documents optional webcam streaming and on-robot detection, plus YOLO evaluation utilities. Source excerpts show the detector publishing target poses and the follower subscribing to them; other subsystem links below use README-documented behavior where implementation was not sampled.

Main entry points: [`src/rokey_pjt/rokey_pjt/rc_car_follower.py`](https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/rc_car_follower.py) (Pursuit state machine), [`src/rokey_pjt/rokey_pjt/webcam_detector.py`](https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/webcam_detector.py) (Webcam detector), [`src/rokey_pjt/rokey_pjt/paths.py`](https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/paths.py) (Repository paths), [`src/rokey_pjt/rokey_pjt/calibrate_webcam_v2.py`](https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/calibrate_webcam_v2.py) (Webcam calibration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_vision["Webcam vision"]
  node_webcam_detector["Webcam detector<br/>[webcam_detector.py]"]
  node_webcam_stream["Webcam stream"]
  node_target_pose["Target pose topics<br/>[webcam_detector.py]"]
  node_yolo_inspector["Robot-camera inspector<br/>[yolo_detector.py]"]
end

subgraph group_robot["Robot pursuit"]
  node_follower["Pursuit state machine<br/>[rc_car_follower.py]"]
end

subgraph group_calibration["Calibration"]
  node_calibrator["Webcam calibration"]
  node_calibrator_v1["Basic calibration"]
  node_homography["Homography artifact"]
  node_paths["Repository paths<br/>[paths.py]"]
end

subgraph group_evaluation["Model evaluation"]
  node_yolo_compare["YOLO comparison report<br/>[yolo_compare.py]"]
  node_yolo_stats["YOLO run statistics<br/>[yolo_stats.py]"]
  node_report_utils["Evaluation utilities"]
end

node_webcam(("Fixed webcam"))
node_yolo["YOLO model"]
node_oakd["OAK-D camera"]
node_lidar["2D lidar"]
node_nav2["Nav2 navigation"]
node_robot(("TurtleBot4"))
node_calib_inputs["RViz / AMCL points"]

node_webcam -->|"supplies frames"| node_webcam_detector
node_webcam_detector -->|"runs inference"| node_yolo
node_webcam_detector -->|"publishes poses"| node_target_pose
node_webcam_detector -->|"transforms coordinates"| node_homography
node_webcam_detector -.->|"optional image stream"| node_webcam_stream
node_target_pose -->|"feeds approach goals"| node_follower
node_oakd -->|"supplies RGB and depth"| node_follower
node_lidar -->|"provides scan status"| node_follower
node_follower -->|"sends navigation goals"| node_nav2
node_follower -->|"publishes rotation commands"| node_robot
node_nav2 -->|"drives and avoids obstacles"| node_robot
node_follower -->|"recovers lifecycle"| node_nav2
node_calib_inputs -->|"provides map points"| node_calibrator
node_calib_inputs -->|"provides map points"| node_calibrator_v1
node_calibrator -->|"computes and saves"| node_homography
node_calibrator_v1 -->|"computes and saves"| node_homography
node_calibrator -->|"uses model paths"| node_paths
node_calibrator_v1 -->|"uses model paths"| node_paths
node_webcam_detector -->|"uses model paths"| node_paths
node_follower -->|"uses model paths"| node_paths
node_oakd -->|"supplies camera images"| node_yolo_inspector
node_yolo_inspector -->|"runs inference"| node_yolo
node_yolo_compare -->|"uses evaluation helpers"| node_report_utils
node_yolo_stats -->|"uses evaluation helpers"| node_report_utils

click node_webcam_detector "https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/webcam_detector.py"
click node_webcam_stream "https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/webcam_publisher.py"
click node_target_pose "https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/webcam_detector.py"
click node_follower "https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/rc_car_follower.py"
click node_calibrator "https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/calibrate_webcam_v2.py"
click node_calibrator_v1 "https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/calibrate_webcam.py"
click node_homography "https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/calibrate_webcam_v2.py"
click node_paths "https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/paths.py"
click node_yolo_inspector "https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/yolo_detector.py"
click node_yolo_compare "https://github.com/mi1nn/overwatch-amr/blob/main/scripts/yolo/yolo_compare.py"
click node_yolo_stats "https://github.com/mi1nn/overwatch-amr/blob/main/scripts/yolo/yolo_stats.py"
click node_report_utils "https://github.com/mi1nn/overwatch-amr/blob/main/scripts/yolo/yolo_report_utils.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_webcam_detector,node_webcam_stream,node_target_pose,node_yolo_inspector toneBlue
class node_follower toneAmber
class node_calibrator,node_calibrator_v1,node_homography,node_paths toneMint
class node_yolo_compare,node_yolo_stats,node_report_utils toneRose
class node_webcam,node_yolo,node_oakd,node_lidar,node_nav2,node_robot,node_calib_inputs toneIndigo
```

## Components

### Webcam vision

- [Webcam detector](https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/webcam_detector.py): `src/rokey_pjt/rokey_pjt/webcam_detector.py`
- [Webcam stream](https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/webcam_publisher.py): `src/rokey_pjt/rokey_pjt/webcam_publisher.py`
- [Target pose topics](https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/webcam_detector.py): `src/rokey_pjt/rokey_pjt/webcam_detector.py`
- [Robot-camera inspector](https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/yolo_detector.py): `src/rokey_pjt/rokey_pjt/yolo_detector.py`

### Robot pursuit

- [Pursuit state machine](https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/rc_car_follower.py): `src/rokey_pjt/rokey_pjt/rc_car_follower.py`

### Calibration

- [Webcam calibration](https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/calibrate_webcam_v2.py): `src/rokey_pjt/rokey_pjt/calibrate_webcam_v2.py`
- [Basic calibration](https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/calibrate_webcam.py): `src/rokey_pjt/rokey_pjt/calibrate_webcam.py`
- [Homography artifact](https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/calibrate_webcam_v2.py): `src/rokey_pjt/rokey_pjt/calibrate_webcam_v2.py`
- [Repository paths](https://github.com/mi1nn/overwatch-amr/blob/main/src/rokey_pjt/rokey_pjt/paths.py): `src/rokey_pjt/rokey_pjt/paths.py`

### Model evaluation

- [YOLO comparison report](https://github.com/mi1nn/overwatch-amr/blob/main/scripts/yolo/yolo_compare.py): `scripts/yolo/yolo_compare.py`
- [YOLO run statistics](https://github.com/mi1nn/overwatch-amr/blob/main/scripts/yolo/yolo_stats.py): `scripts/yolo/yolo_stats.py`
- [Evaluation utilities](https://github.com/mi1nn/overwatch-amr/blob/main/scripts/yolo/yolo_report_utils.py): `scripts/yolo/yolo_report_utils.py`

### Other components

- **Fixed webcam**
- **YOLO model**
- **OAK-D camera**
- **2D lidar**
- **Nav2 navigation**
- **TurtleBot4**
- **RViz / AMCL points**

## Connections

- Fixed webcam → Webcam detector: supplies frames
- Webcam detector → YOLO model: runs inference
- Webcam detector → Target pose topics: publishes poses (evidence: `src/rokey_pjt/rokey_pjt/webcam_detector.py`)
- Webcam detector → Homography artifact: transforms coordinates
- Webcam detector → Webcam stream: optional image stream
- Target pose topics → Pursuit state machine: feeds approach goals (evidence: `src/rokey_pjt/rokey_pjt/rc_car_follower.py`)
- OAK-D camera → Pursuit state machine: supplies RGB and depth
- 2D lidar → Pursuit state machine: provides scan status
- Pursuit state machine → Nav2 navigation: sends navigation goals
- Pursuit state machine → TurtleBot4: publishes rotation commands (evidence: `src/rokey_pjt/rokey_pjt/rc_car_follower.py`)
- Nav2 navigation → TurtleBot4: drives and avoids obstacles
- Pursuit state machine → Nav2 navigation: recovers lifecycle (evidence: `src/rokey_pjt/rokey_pjt/rc_car_follower.py`)
- RViz / AMCL points → Webcam calibration: provides map points (evidence: `src/rokey_pjt/rokey_pjt/calibrate_webcam_v2.py`)
- RViz / AMCL points → Basic calibration: provides map points (evidence: `src/rokey_pjt/rokey_pjt/calibrate_webcam.py`)
- Webcam calibration → Homography artifact: computes and saves (evidence: `src/rokey_pjt/rokey_pjt/calibrate_webcam_v2.py`)
- Basic calibration → Homography artifact: computes and saves (evidence: `src/rokey_pjt/rokey_pjt/calibrate_webcam.py`)
- Webcam calibration → Repository paths: uses model paths (evidence: `src/rokey_pjt/rokey_pjt/calibrate_webcam_v2.py`)
- Basic calibration → Repository paths: uses model paths (evidence: `src/rokey_pjt/rokey_pjt/calibrate_webcam.py`)
- Webcam detector → Repository paths: uses model paths (evidence: `src/rokey_pjt/rokey_pjt/webcam_detector.py`)
- Pursuit state machine → Repository paths: uses model paths (evidence: `src/rokey_pjt/rokey_pjt/rc_car_follower.py`)
- OAK-D camera → Robot-camera inspector: supplies camera images (evidence: `src/rokey_pjt/rokey_pjt/yolo_detector.py`)
- Robot-camera inspector → YOLO model: runs inference (evidence: `src/rokey_pjt/rokey_pjt/yolo_detector.py`)
- YOLO comparison report → Evaluation utilities: uses evaluation helpers (evidence: `scripts/yolo/yolo_compare.py`)
- YOLO run statistics → Evaluation utilities: uses evaluation helpers (evidence: `scripts/yolo/yolo_stats.py`)
