# ubc-snowbots/roverflake2 architecture

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

- Interactive diagram: https://gitdiagram.com/ubc-snowbots/roverflake2
- Repository: https://github.com/ubc-snowbots/roverflake2

## Overview

RoverFlake2 is a ROS 2 rover software workspace. Its principal operator workflow spans HMI and joystick input, rover motion or arm control, and hardware interfaces; supporting subsystems provide camera/vision, navigation, mission recording, and science operations. The tree documents these capabilities, while sampled source confirms only selected connections: mission services and persistence, camera topic routing, and science-panel subscriptions. Other subsystem wiring is not inferred from names alone.

Main entry points: [`src/rover_mapping/rover_mapping/mission_manager.py`](https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_mapping/rover_mapping/mission_manager.py) (Mission manager), [`src/rover_hmi_core/src/hmi_host.cpp`](https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_hmi_core/src/hmi_host.cpp) (HMI modules), [`src/drive_control/src/drive_control.cpp`](https://github.com/ubc-snowbots/roverflake2/blob/main/src/drive_control/src/drive_control.cpp) (Drive control), [`src/rover_hmi_core/src/science/science_pipeline_module.cpp`](https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_hmi_core/src/science/science_pipeline_module.cpp) (Science pipeline panel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operator["Operator HMI"]
  node_hmi["Rover HMI<br/>[RoverHMI.cpp]"]
  node_hmi_core["HMI modules<br/>[hmi_host.cpp]"]
  node_joystick["Joystick input"]
end

subgraph group_control["Rover Control"]
  node_drive["Drive control<br/>[drive_control.cpp]"]
  node_arm["Arm control<br/>[moveit_control.cpp]"]
  node_base_comms["Base communications<br/>[comms_relay.cpp]"]
  node_manager["Device manager"]
  node_hardware["CAN hardware"]
  node_arm_hw["Moteus driver"]
end

subgraph group_sensing["Sensing and Navigation"]
  node_camera["Camera pipeline"]
  node_broadcaster["Camera broadcaster"]
  node_vision["Vision nodes"]
  node_object_detection["Object detection"]
  node_localization["Localization<br/>[mahony_filter.py]"]
  node_navigation["Waypoint navigation"]
end

subgraph group_mission["Mission Data"]
  node_mission_manager["Mission manager<br/>[mission_manager.py]"]
  node_mission_files[("Mission files<br/>[mission_io.py]")]
  node_exporter["Map exporter<br/>[exporter.py]"]
end

subgraph group_science["Science Operations"]
  node_science_pipeline["Science pipeline panel"]
  node_science_control["Science controls<br/>[science_module.cpp]"]
end

node_user(("Rover operator"))
node_gnss(("GNSS fix source"))
node_science_data(("Science telemetry"))

node_user -->|"operates"| node_hmi
node_hmi -->|"hosts modules"| node_hmi_core
node_user -->|"provides input"| node_joystick
node_joystick -.->|"control input"| node_drive
node_hmi_core -.->|"drive commands"| node_drive
node_hmi_core -.->|"arm commands"| node_arm
node_drive -.->|"control messages"| node_base_comms
node_arm -.->|"arm commands"| node_arm_hw
node_base_comms -.->|"device messages"| node_manager
node_manager -.->|"device access"| node_hardware
node_camera -.->|"selected image output"| node_user
node_broadcaster -.->|"broadcast images"| node_user
node_mission_manager -->|"subscribes fix"| node_gnss
node_mission_manager -->|"reads and writes"| node_mission_files
node_mission_manager -->|"exports mission"| node_exporter
node_user -.->|"mission services"| node_mission_manager
node_science_pipeline -->|"subscribes telemetry"| node_science_data
node_science_pipeline -->|"subscribes commands"| node_science_control

click node_hmi "https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_hmi/src/RoverHMI.cpp"
click node_hmi_core "https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_hmi_core/src/hmi_host.cpp"
click node_joystick "https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_launchers/launch/game_controller.launch.py"
click node_drive "https://github.com/ubc-snowbots/roverflake2/blob/main/src/drive_control/src/drive_control.cpp"
click node_arm "https://github.com/ubc-snowbots/roverflake2/blob/main/src/arm_control/src/moveit_control.cpp"
click node_base_comms "https://github.com/ubc-snowbots/roverflake2/blob/main/src/comms_base_control/src/comms_relay.cpp"
click node_manager "https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_manager/src/cbsHardwareManagerNode.cpp"
click node_hardware "https://github.com/ubc-snowbots/roverflake2/blob/main/src/arm_hardware_interface/src/generic_can_hardware_interface.cpp"
click node_arm_hw "https://github.com/ubc-snowbots/roverflake2/blob/main/src/arm_hardware_interface/src/moteus_driver_node.cpp"
click node_camera "https://github.com/ubc-snowbots/roverflake2/blob/main/src/cameras_cpp/src/cam_pipeline_node.cpp"
click node_broadcaster "https://github.com/ubc-snowbots/roverflake2/blob/main/src/cameras_cpp/src/dyn_cam_pipeline_node.cpp"
click node_vision "https://github.com/ubc-snowbots/roverflake2/tree/main/src/rover_vision/rover_vision"
click node_object_detection "https://github.com/ubc-snowbots/roverflake2/blob/main/src/object_detection/object_detection/yolo_detector_node.py"
click node_localization "https://github.com/ubc-snowbots/roverflake2/blob/main/src/localization_dev/localization_dev/mahony_filter.py"
click node_navigation "https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_search/rover_search/navigate_waypoints.py"
click node_mission_manager "https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_mapping/rover_mapping/mission_manager.py"
click node_mission_files "https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_mapping/rover_mapping/mission_io.py"
click node_exporter "https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_mapping/rover_mapping/exporter.py"
click node_science_pipeline "https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_hmi_core/src/science/science_pipeline_module.cpp"
click node_science_control "https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_hmi_core/src/science/science_module.cpp"

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_hmi,node_hmi_core,node_joystick toneBlue
class node_drive,node_arm,node_base_comms,node_manager,node_hardware,node_arm_hw toneAmber
class node_camera,node_broadcaster,node_vision,node_object_detection,node_localization,node_navigation toneMint
class node_mission_manager,node_mission_files,node_exporter toneRose
class node_science_pipeline,node_science_control,node_user,node_gnss,node_science_data toneIndigo
```

## Components

### Operator HMI

- [Rover HMI](https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_hmi/src/RoverHMI.cpp): `src/rover_hmi/src/RoverHMI.cpp`
- [HMI modules](https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_hmi_core/src/hmi_host.cpp): `src/rover_hmi_core/src/hmi_host.cpp`
- [Joystick input](https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_launchers/launch/game_controller.launch.py): `src/rover_launchers/launch/game_controller.launch.py`

### Rover Control

- [Drive control](https://github.com/ubc-snowbots/roverflake2/blob/main/src/drive_control/src/drive_control.cpp): `src/drive_control/src/drive_control.cpp`
- [Arm control](https://github.com/ubc-snowbots/roverflake2/blob/main/src/arm_control/src/moveit_control.cpp): `src/arm_control/src/moveit_control.cpp`
- [Base communications](https://github.com/ubc-snowbots/roverflake2/blob/main/src/comms_base_control/src/comms_relay.cpp): `src/comms_base_control/src/comms_relay.cpp`
- [Device manager](https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_manager/src/cbsHardwareManagerNode.cpp): `src/rover_manager/src/cbsHardwareManagerNode.cpp`
- [CAN hardware](https://github.com/ubc-snowbots/roverflake2/blob/main/src/arm_hardware_interface/src/generic_can_hardware_interface.cpp): `src/arm_hardware_interface/src/generic_can_hardware_interface.cpp`
- [Moteus driver](https://github.com/ubc-snowbots/roverflake2/blob/main/src/arm_hardware_interface/src/moteus_driver_node.cpp): `src/arm_hardware_interface/src/moteus_driver_node.cpp`

### Sensing and Navigation

- [Camera pipeline](https://github.com/ubc-snowbots/roverflake2/blob/main/src/cameras_cpp/src/cam_pipeline_node.cpp): `src/cameras_cpp/src/cam_pipeline_node.cpp`
- [Camera broadcaster](https://github.com/ubc-snowbots/roverflake2/blob/main/src/cameras_cpp/src/dyn_cam_pipeline_node.cpp): `src/cameras_cpp/src/dyn_cam_pipeline_node.cpp`
- [Vision nodes](https://github.com/ubc-snowbots/roverflake2/tree/main/src/rover_vision/rover_vision): `src/rover_vision/rover_vision`
- [Object detection](https://github.com/ubc-snowbots/roverflake2/blob/main/src/object_detection/object_detection/yolo_detector_node.py): `src/object_detection/object_detection/yolo_detector_node.py`
- [Localization](https://github.com/ubc-snowbots/roverflake2/blob/main/src/localization_dev/localization_dev/mahony_filter.py): `src/localization_dev/localization_dev/mahony_filter.py`
- [Waypoint navigation](https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_search/rover_search/navigate_waypoints.py): `src/rover_search/rover_search/navigate_waypoints.py`

### Mission Data

- [Mission manager](https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_mapping/rover_mapping/mission_manager.py): `src/rover_mapping/rover_mapping/mission_manager.py`
- [Mission files](https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_mapping/rover_mapping/mission_io.py): `src/rover_mapping/rover_mapping/mission_io.py`
- [Map exporter](https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_mapping/rover_mapping/exporter.py): `src/rover_mapping/rover_mapping/exporter.py`

### Science Operations

- [Science pipeline panel](https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_hmi_core/src/science/science_pipeline_module.cpp): `src/rover_hmi_core/src/science/science_pipeline_module.cpp`
- [Science controls](https://github.com/ubc-snowbots/roverflake2/blob/main/src/rover_hmi_core/src/science/science_module.cpp): `src/rover_hmi_core/src/science/science_module.cpp`

### Other components

- **Rover operator**
- **GNSS fix source**
- **Science telemetry**

## Connections

- Rover operator → Rover HMI: operates
- Rover HMI → HMI modules: hosts modules
- Rover operator → Joystick input: provides input
- Joystick input → Drive control: control input
- HMI modules → Drive control: drive commands
- HMI modules → Arm control: arm commands
- Drive control → Base communications: control messages
- Arm control → Moteus driver: arm commands
- Base communications → Device manager: device messages
- Device manager → CAN hardware: device access
- Camera pipeline → Rover operator: selected image output
- Camera broadcaster → Rover operator: broadcast images
- Mission manager → GNSS fix source: subscribes fix
- Mission manager → Mission files: reads and writes
- Mission manager → Map exporter: exports mission
- Rover operator → Mission manager: mission services
- Science pipeline panel → Science telemetry: subscribes telemetry
- Science pipeline panel → Science controls: subscribes commands
