# chj1319/ros-vision-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/chj1319/ros-vision-tracker
- Repository: https://github.com/chj1319/ros-vision-tracker

## Overview

ROS-Vision-Tracker is a ROS 2 camera-tracking system: the Pi captures color and aligned depth, detects and tracks a blue cube, and publishes motion commands for a pan/tilt camera. It also supports annotated previews, remote RViz visualization, and offline tuning/evaluation and bag replay. The main runtime links are documented in the README; sampled source confirms detector/tracker delegation and preview processing. Some launch, replay, and control internals were not sampled, so those links follow documented relationships.

Main entry points: [`xmen_tracker/xmen_tracker/tracker_node.py`](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/tracker_node.py) (Tracking node), [`xmen_tracker/xmen_tracker/preview_node.py`](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/preview_node.py) (JPEG preview), [`xmen_tracker/xmen_tracker/detector.py`](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/detector.py) (Cube detection), [`xmen_tracker/xmen_tracker/rviz_node.py`](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/rviz_node.py) (RViz visualization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_vision["Vision tracking"]
  node_camera["RealSense capture<br/>[realsense_node.py]"]
  node_detector["Cube detection<br/>[detector.py]"]
  node_tracking["Cube tracker<br/>[cube_tracker.py]"]
  node_tracker_node["Tracking node<br/>[tracker_node.py]"]
end

subgraph group_motion["Camera motion"]
  node_control["Serial control<br/>[control_lite.py]"]
  node_control_full["Full control<br/>[control.py]"]
  node_firmware["OpenCR firmware<br/>[opencr_lite.ino]"]
end

subgraph group_display["Visualization"]
  node_preview["JPEG preview<br/>[preview_node.py]"]
  node_overlay["Image overlay<br/>[overlay.py]"]
  node_rviz["RViz visualization<br/>[rviz_node.py]"]
  node_markers["Target markers<br/>[markers.py]"]
  node_bringup["Launch configuration<br/>[hardware_launch.py]"]
  node_rviz_launch["Remote RViz launch<br/>[rviz2_launch.py]"]
end

subgraph group_analysis["Tuning analysis"]
  node_tuning["Detector tuning<br/>[tuning.py]"]
  node_evaluation["Detection evaluation<br/>[evaluate.py]"]
  node_csrt_tool["CSRT test tool<br/>[csrt_track.py]"]
  node_bags[("Recorded bags")]
end

subgraph group_robot["Robot model"]
  node_description["Robot description<br/>[cctv.urdf]"]
end

node_operator(("Operator"))
node_opencr{{"OpenCR board"}}
node_servos{{"Pan-tilt servos"}}

node_operator -->|"launches"| node_bringup
node_bringup -->|"starts capture"| node_camera
node_bringup -->|"starts tracking"| node_tracker_node
node_camera -->|"publishes frames"| node_tracker_node
node_tracker_node -->|"detects targets"| node_detector
node_tracker_node -->|"uses tracker"| node_tracking
node_detector -->|"provides detections"| node_tracking
node_tracker_node -->|"publishes commands"| node_control
node_control -->|"serial commands"| node_opencr
node_control_full -.->|"serial control"| node_opencr
node_opencr -->|"drives axes"| node_servos
node_firmware -->|"runs on"| node_opencr
node_camera -->|"publishes color"| node_preview
node_tracker_node -->|"publishes boxes"| node_preview
node_preview -->|"annotates frames"| node_overlay
node_preview -->|"sends JPEG"| node_rviz
node_tracker_node -->|"publishes target"| node_rviz
node_rviz -->|"builds markers"| node_markers
node_rviz_launch -->|"starts visualization"| node_rviz
node_rviz_launch -->|"displays robot model"| node_description
node_operator -->|"tunes detector"| node_tuning
node_tuning -->|"tests settings"| node_detector
node_operator -->|"evaluates detection"| node_evaluation
node_evaluation -->|"runs detection"| node_detector
node_operator -->|"tests tracking"| node_csrt_tool
node_csrt_tool -->|"uses tracker"| node_tracking
node_bags -.->|"feeds replay"| node_evaluation

click node_camera "https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/realsense_node.py"
click node_detector "https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/detector.py"
click node_tracking "https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/cube_tracker.py"
click node_tracker_node "https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/tracker_node.py"
click node_control "https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_control/xmen_control/control_lite.py"
click node_control_full "https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_control/xmen_control/control.py"
click node_firmware "https://github.com/chj1319/ros-vision-tracker/blob/main/firmware/opencr_lite.ino"
click node_preview "https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/preview_node.py"
click node_overlay "https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/overlay.py"
click node_rviz "https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/rviz_node.py"
click node_markers "https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/markers.py"
click node_bringup "https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_bringup/launch/hardware_launch.py"
click node_rviz_launch "https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_bringup/launch/rviz2_launch.py"
click node_tuning "https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/tuning.py"
click node_evaluation "https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/evaluate.py"
click node_csrt_tool "https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/tools/csrt_track.py"
click node_bags "https://github.com/chj1319/ros-vision-tracker/tree/main/lv2_module5/results/bags"
click node_description "https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_description/urdf/cctv.urdf"

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_camera,node_detector,node_tracking,node_tracker_node toneBlue
class node_control,node_control_full,node_firmware toneAmber
class node_preview,node_overlay,node_rviz,node_markers,node_bringup,node_rviz_launch toneMint
class node_tuning,node_evaluation,node_csrt_tool,node_bags toneRose
class node_description,node_operator,node_opencr,node_servos toneIndigo
```

## Components

### Vision tracking

- [RealSense capture](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/realsense_node.py): `xmen_tracker/xmen_tracker/realsense_node.py`
- [Cube detection](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/detector.py): `xmen_tracker/xmen_tracker/detector.py`
- [Cube tracker](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/cube_tracker.py): `xmen_tracker/xmen_tracker/cube_tracker.py`
- [Tracking node](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/tracker_node.py): `xmen_tracker/xmen_tracker/tracker_node.py`

### Camera motion

- [Serial control](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_control/xmen_control/control_lite.py): `xmen_control/xmen_control/control_lite.py`
- [Full control](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_control/xmen_control/control.py): `xmen_control/xmen_control/control.py`
- [OpenCR firmware](https://github.com/chj1319/ros-vision-tracker/blob/main/firmware/opencr_lite.ino): `firmware/opencr_lite.ino`

### Visualization

- [JPEG preview](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/preview_node.py): `xmen_tracker/xmen_tracker/preview_node.py`
- [Image overlay](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/overlay.py): `xmen_tracker/xmen_tracker/overlay.py`
- [RViz visualization](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/rviz_node.py): `xmen_tracker/xmen_tracker/rviz_node.py`
- [Target markers](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/markers.py): `xmen_tracker/xmen_tracker/markers.py`
- [Launch configuration](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_bringup/launch/hardware_launch.py): `xmen_bringup/launch/hardware_launch.py`
- [Remote RViz launch](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_bringup/launch/rviz2_launch.py): `xmen_bringup/launch/rviz2_launch.py`

### Tuning analysis

- [Detector tuning](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/tuning.py): `xmen_tracker/xmen_tracker/tuning.py`
- [Detection evaluation](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/xmen_tracker/evaluate.py): `xmen_tracker/xmen_tracker/evaluate.py`
- [CSRT test tool](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_tracker/tools/csrt_track.py): `xmen_tracker/tools/csrt_track.py`
- [Recorded bags](https://github.com/chj1319/ros-vision-tracker/tree/main/lv2_module5/results/bags): `lv2_module5/results/bags`

### Robot model

- [Robot description](https://github.com/chj1319/ros-vision-tracker/blob/main/xmen_description/urdf/cctv.urdf): `xmen_description/urdf/cctv.urdf`

### Other components

- **Operator**
- **OpenCR board**
- **Pan-tilt servos**

## Connections

- Operator → Launch configuration: launches (evidence: `README.md`)
- Launch configuration → RealSense capture: starts capture (evidence: `README.md`)
- Launch configuration → Tracking node: starts tracking (evidence: `README.md`)
- RealSense capture → Tracking node: publishes frames (evidence: `README.md`)
- Tracking node → Cube detection: detects targets (evidence: `xmen_tracker/xmen_tracker/tracker_node.py`)
- Tracking node → Cube tracker: uses tracker (evidence: `xmen_tracker/xmen_tracker/tracker_node.py`)
- Cube detection → Cube tracker: provides detections (evidence: `xmen_tracker/xmen_tracker/cube_tracker.py`)
- Tracking node → Serial control: publishes commands (evidence: `README.md`)
- Serial control → OpenCR board: serial commands (evidence: `README.md`)
- Full control → OpenCR board: serial control (evidence: `README.md`)
- OpenCR board → Pan-tilt servos: drives axes (evidence: `README.md`)
- OpenCR firmware → OpenCR board: runs on (evidence: `README.md`)
- RealSense capture → JPEG preview: publishes color (evidence: `README.md`)
- Tracking node → JPEG preview: publishes boxes (evidence: `xmen_tracker/xmen_tracker/preview_node.py`)
- JPEG preview → Image overlay: annotates frames (evidence: `xmen_tracker/xmen_tracker/preview_node.py`)
- JPEG preview → RViz visualization: sends JPEG (evidence: `README.md`)
- Tracking node → RViz visualization: publishes target (evidence: `README.md`)
- RViz visualization → Target markers: builds markers (evidence: `xmen_tracker/xmen_tracker/rviz_node.py`)
- Remote RViz launch → RViz visualization: starts visualization (evidence: `README.md`)
- Remote RViz launch → Robot description: displays robot model (evidence: `README.md`)
- Operator → Detector tuning: tunes detector (evidence: `xmen_tracker/xmen_tracker/tuning.py`)
- Detector tuning → Cube detection: tests settings (evidence: `xmen_tracker/xmen_tracker/tuning.py`)
- Operator → Detection evaluation: evaluates detection (evidence: `xmen_tracker/xmen_tracker/evaluate.py`)
- Detection evaluation → Cube detection: runs detection (evidence: `xmen_tracker/xmen_tracker/evaluate.py`)
- Operator → CSRT test tool: tests tracking (evidence: `xmen_tracker/tools/csrt_track.py`)
- CSRT test tool → Cube tracker: uses tracker (evidence: `xmen_tracker/tools/csrt_track.py`)
- Recorded bags → Detection evaluation: feeds replay (evidence: `README.md`)
