# cowsjh/lv2_horus_assignment architecture

> Architecture diagram of the GitHub repository cowsjh/lv2_horus_assignment, 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/cowsjh/lv2_horus_assignment
- Repository: https://github.com/cowsjh/lv2_horus_assignment

## Overview

Horus is a ROS 2 pan–tilt target-tracking project: camera images are processed into target coordinates, tracking logic determines whether to follow, and control commands travel over serial to a motor board. The sampled sources show the perception, serial, and firmware layers; the center-to-control command connection is not visible in the excerpts, so it is marked unverified. The repository also includes a bag-metric reanalysis utility, shown as a separate results branch.

Main entry points: [`lv2_module5/firmware/pan_tilt_fw/motor.cpp`](https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/firmware/pan_tilt_fw/motor.cpp) (Motor driver), [`lv2_module5/ros2_ws/src/perception/src/perception_node.cpp`](https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/ros2_ws/src/perception/src/perception_node.cpp) (Perception node), [`lv2_module5/ros2_ws/src/control/src/control_node.cpp`](https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/ros2_ws/src/control/src/control_node.cpp) (Serial control node), [`lv2_module5/firmware/pan_tilt_fw/protocol.cpp`](https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/firmware/pan_tilt_fw/protocol.cpp) (Firmware protocol)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensing["Perception"]
  node_perception_node["Perception node"]
  node_detector["Target detector<br/>[detector.cpp]"]
  node_detector_api["Detector API<br/>[detector.hpp]"]
end

subgraph group_tracking["Tracking"]
  node_center["Tracking center<br/>[center_node.cpp]"]
end

subgraph group_actuation["Motor actuation"]
  node_control["Serial control node<br/>[control_node.cpp]"]
  node_serial["USB serial link"]
  node_protocol["Firmware protocol<br/>[protocol.cpp]"]
  node_motor["Motor driver<br/>[motor.cpp]"]
  node_firmware_config["Firmware settings<br/>[config.h]"]
end

subgraph group_analysis["Result analysis"]
  node_reanalyze["Bag reanalysis<br/>[reanalyze.py]"]
end

node_camera(("RGB-D camera"))
node_dynamixel["DYNAMIXEL motors"]
node_rosbag[("Recorded ROS bags")]

node_camera -->|"sends images"| node_perception_node
node_perception_node -->|"processes frames"| node_detector
node_detector -->|"implements API"| node_detector_api
node_perception_node -->|"publishes /target"| node_center
node_center -.->|"sends commands"| node_control
node_control -->|"writes commands"| node_serial
node_serial -.->|"carries commands"| node_protocol
node_protocol -->|"dispatches goals"| node_motor
node_motor -->|"drives axes"| node_dynamixel
node_firmware_config -->|"sets limits"| node_motor
node_motor -->|"reports status"| node_protocol
node_serial -->|"returns status"| node_control
node_rosbag -->|"reads topics"| node_reanalyze

click node_perception_node "https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/ros2_ws/src/perception/src/perception_node.cpp"
click node_detector "https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/ros2_ws/src/perception/src/detector.cpp"
click node_detector_api "https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/ros2_ws/src/perception/include/perception/detector.hpp"
click node_center "https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/ros2_ws/src/center/src/center_node.cpp"
click node_control "https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/ros2_ws/src/control/src/control_node.cpp"
click node_protocol "https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/firmware/pan_tilt_fw/protocol.cpp"
click node_motor "https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/firmware/pan_tilt_fw/motor.cpp"
click node_firmware_config "https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/firmware/pan_tilt_fw/config.h"
click node_reanalyze "https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/results/logs/reanalysis/reanalyze.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_perception_node,node_detector,node_detector_api toneBlue
class node_center,node_rosbag toneAmber
class node_control,node_serial,node_protocol,node_motor,node_firmware_config toneMint
class node_reanalyze toneRose
class node_camera,node_dynamixel toneIndigo
```

## Components

### Perception

- [Perception node](https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/ros2_ws/src/perception/src/perception_node.cpp): `lv2_module5/ros2_ws/src/perception/src/perception_node.cpp`
- [Target detector](https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/ros2_ws/src/perception/src/detector.cpp): `lv2_module5/ros2_ws/src/perception/src/detector.cpp`
- [Detector API](https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/ros2_ws/src/perception/include/perception/detector.hpp): `lv2_module5/ros2_ws/src/perception/include/perception/detector.hpp`

### Tracking

- [Tracking center](https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/ros2_ws/src/center/src/center_node.cpp): `lv2_module5/ros2_ws/src/center/src/center_node.cpp`

### Motor actuation

- [Serial control node](https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/ros2_ws/src/control/src/control_node.cpp): `lv2_module5/ros2_ws/src/control/src/control_node.cpp`
- **USB serial link**
- [Firmware protocol](https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/firmware/pan_tilt_fw/protocol.cpp): `lv2_module5/firmware/pan_tilt_fw/protocol.cpp`
- [Motor driver](https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/firmware/pan_tilt_fw/motor.cpp): `lv2_module5/firmware/pan_tilt_fw/motor.cpp`
- [Firmware settings](https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/firmware/pan_tilt_fw/config.h): `lv2_module5/firmware/pan_tilt_fw/config.h`

### Result analysis

- [Bag reanalysis](https://github.com/cowsjh/lv2_horus_assignment/blob/main/lv2_module5/results/logs/reanalysis/reanalyze.py): `lv2_module5/results/logs/reanalysis/reanalyze.py`

### Other components

- **RGB-D camera**
- **DYNAMIXEL motors**
- **Recorded ROS bags**

## Connections

- RGB-D camera → Perception node: sends images (evidence: `lv2_module5/ros2_ws/src/perception/src/perception_node.cpp`)
- Perception node → Target detector: processes frames (evidence: `lv2_module5/ros2_ws/src/perception/src/perception_node.cpp`)
- Target detector → Detector API: implements API (evidence: `lv2_module5/ros2_ws/src/perception/src/detector.cpp`)
- Perception node → Tracking center: publishes /target (evidence: `lv2_module5/ros2_ws/src/perception/src/perception_node.cpp`)
- Tracking center → Serial control node: sends commands
- Serial control node → USB serial link: writes commands (evidence: `lv2_module5/ros2_ws/src/control/src/control_node.cpp`)
- USB serial link → Firmware protocol: carries commands
- Firmware protocol → Motor driver: dispatches goals (evidence: `lv2_module5/firmware/pan_tilt_fw/protocol.cpp`)
- Motor driver → DYNAMIXEL motors: drives axes (evidence: `lv2_module5/firmware/pan_tilt_fw/motor.cpp`)
- Firmware settings → Motor driver: sets limits (evidence: `lv2_module5/firmware/pan_tilt_fw/motor.cpp`)
- Motor driver → Firmware protocol: reports status (evidence: `lv2_module5/firmware/pan_tilt_fw/protocol.cpp`)
- USB serial link → Serial control node: returns status (evidence: `lv2_module5/ros2_ws/src/control/src/control_node.cpp`)
- Recorded ROS bags → Bag reanalysis: reads topics (evidence: `lv2_module5/results/logs/reanalysis/reanalyze.py`)
