# axedelubac/yoctoraspi architecture

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

- Interactive diagram: https://gitdiagram.com/axedelubac/yoctoraspi
- Repository: https://github.com/axedelubac/yoctoraspi

## Overview

yoctoRaspi builds and runs an embedded Raspberry Pi perception system. In the standalone workflow, lidar scans are clustered into obstacles, translated into MCU commands, and combined with camera detections; the UART sends commands while the camera loop reports fused results. A ROS 2 alternative publishes lidar scans and camera images/detections for remote monitoring through rosbridge and Foxglove. The Yocto layer customizes the image and boot configuration; documented U-Boot network updates replace the kernel and optionally the root filesystem. The graph uses sampled source for application calls and README statements for deployment and monitoring; unsampled recipe internals are represented only at their enclosing directory.

Main entry points: [`dev/yoctowatch/src/main.cpp`](https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch/src/main.cpp) (Standalone runtime), [`dev/yoctowatch/src/camera.cpp`](https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch/src/camera.cpp) (Camera detection), [`meta-custom/recipes-perception`](https://github.com/axedelubac/yoctoraspi/tree/main/meta-custom/recipes-perception) (Perception app recipes), [`dev/yoctowatch_ros2/src/lidar_node.cpp`](https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch_ros2/src/lidar_node.cpp) (ROS lidar node)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_perception["Perception runtime"]
  node_standalone["Standalone runtime<br/>[main.cpp]"]
  node_lidar["Lidar acquisition<br/>[LidarComm.cpp]"]
  node_obstacles["Obstacle detection"]
  node_commands["MCU command logic<br/>[McuCommand.cpp]"]
  node_uart["UART communication<br/>[UartComm.cpp]"]
  node_camera["Camera detection<br/>[camera.cpp]"]
  node_fusion["Sensor fusion<br/>[sensorFusion.cpp]"]
  node_models["Detector models"]
end

subgraph group_ros["ROS 2 interfaces"]
  node_ros_lidar["ROS lidar node<br/>[lidar_node.cpp]"]
  node_ros_camera["ROS camera node<br/>[camera_node.cpp]"]
  node_ros_topics["ROS 2 topics"]
end

subgraph group_image["Embedded image"]
  node_image_config["Yocto image configuration"]
  node_ros_app_recipe["Perception app recipes"]
end

subgraph group_updates["Network updates"]
  node_boot_config["U-Boot update script<br/>[boot.cmd.in]"]
  node_update_host["Update host services<br/>[dnsmasq.conf]"]
  node_uboot["U-Boot on device"]
end

subgraph group_monitor["Remote monitoring"]
  node_rosbridge["rosbridge WebSocket"]
  node_foxglove(("Foxglove client"))
end

node_operator(("Device operator"))
node_hardware["Lidar, camera, MCU"]

node_operator -->|"runs"| node_standalone
node_standalone -->|"starts and scans"| node_lidar
node_standalone -->|"clusters scans"| node_obstacles
node_standalone -->|"computes command"| node_commands
node_standalone -->|"sends command"| node_uart
node_standalone -->|"processes frames"| node_camera
node_standalone -->|"fuses results"| node_fusion
node_camera -->|"loads model"| node_models
node_lidar -.->|"acquires scans"| node_hardware
node_camera -.->|"captures frames"| node_hardware
node_uart -.->|"sends frames"| node_hardware
node_operator -->|"runs ROS nodes"| node_ros_lidar
node_operator -->|"runs ROS nodes"| node_ros_camera
node_ros_lidar -->|"publishes scans"| node_ros_topics
node_ros_camera -->|"publishes images and detections"| node_ros_topics
node_ros_topics -->|"exposes topics"| node_rosbridge
node_rosbridge -->|"streams monitoring"| node_foxglove
node_foxglove -->|"publishes messages"| node_rosbridge
node_image_config -.->|"includes applications"| node_ros_app_recipe
node_ros_app_recipe -.->|"deploys ROS application"| node_ros_lidar
node_ros_app_recipe -.->|"deploys ROS application"| node_ros_camera
node_operator -->|"initiates update"| node_uboot
node_uboot -->|"uses update flow"| node_boot_config
node_uboot -->|"downloads kernel or rootfs"| node_update_host

click node_standalone "https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch/src/main.cpp"
click node_lidar "https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch/src/LidarComm.cpp"
click node_obstacles "https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch/src/obstacleDetection.cpp"
click node_commands "https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch/src/McuCommand.cpp"
click node_uart "https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch/src/UartComm.cpp"
click node_camera "https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch/src/camera.cpp"
click node_fusion "https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch/src/sensorFusion.cpp"
click node_models "https://github.com/axedelubac/yoctoraspi/tree/main/dev/yoctowatch/models"
click node_ros_lidar "https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch_ros2/src/lidar_node.cpp"
click node_ros_camera "https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch_ros2/src/camera_node.cpp"
click node_image_config "https://github.com/axedelubac/yoctoraspi/tree/main/meta-custom/recipes-core/images"
click node_ros_app_recipe "https://github.com/axedelubac/yoctoraspi/tree/main/meta-custom/recipes-perception"
click node_boot_config "https://github.com/axedelubac/yoctoraspi/blob/main/meta-custom/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in"
click node_update_host "https://github.com/axedelubac/yoctoraspi/blob/main/tools/netboot/dnsmasq.conf"

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_standalone,node_lidar,node_obstacles,node_commands,node_uart,node_camera,node_fusion,node_models toneBlue
class node_ros_lidar,node_ros_camera,node_ros_topics toneAmber
class node_image_config,node_ros_app_recipe toneMint
class node_boot_config,node_update_host,node_uboot toneRose
class node_rosbridge,node_foxglove,node_operator,node_hardware toneIndigo
```

## Components

### Perception runtime

- [Standalone runtime](https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch/src/main.cpp): `dev/yoctowatch/src/main.cpp`
- [Lidar acquisition](https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch/src/LidarComm.cpp): `dev/yoctowatch/src/LidarComm.cpp`
- [Obstacle detection](https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch/src/obstacleDetection.cpp): `dev/yoctowatch/src/obstacleDetection.cpp`
- [MCU command logic](https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch/src/McuCommand.cpp): `dev/yoctowatch/src/McuCommand.cpp`
- [UART communication](https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch/src/UartComm.cpp): `dev/yoctowatch/src/UartComm.cpp`
- [Camera detection](https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch/src/camera.cpp): `dev/yoctowatch/src/camera.cpp`
- [Sensor fusion](https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch/src/sensorFusion.cpp): `dev/yoctowatch/src/sensorFusion.cpp`
- [Detector models](https://github.com/axedelubac/yoctoraspi/tree/main/dev/yoctowatch/models): `dev/yoctowatch/models`

### ROS 2 interfaces

- [ROS lidar node](https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch_ros2/src/lidar_node.cpp): `dev/yoctowatch_ros2/src/lidar_node.cpp`
- [ROS camera node](https://github.com/axedelubac/yoctoraspi/blob/main/dev/yoctowatch_ros2/src/camera_node.cpp): `dev/yoctowatch_ros2/src/camera_node.cpp`
- **ROS 2 topics**

### Embedded image

- [Yocto image configuration](https://github.com/axedelubac/yoctoraspi/tree/main/meta-custom/recipes-core/images): `meta-custom/recipes-core/images`
- [Perception app recipes](https://github.com/axedelubac/yoctoraspi/tree/main/meta-custom/recipes-perception): `meta-custom/recipes-perception`

### Network updates

- [U-Boot update script](https://github.com/axedelubac/yoctoraspi/blob/main/meta-custom/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in): `meta-custom/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in`
- [Update host services](https://github.com/axedelubac/yoctoraspi/blob/main/tools/netboot/dnsmasq.conf): `tools/netboot/dnsmasq.conf`
- **U-Boot on device**

### Remote monitoring

- **rosbridge WebSocket**
- **Foxglove client**

### Other components

- **Device operator**
- **Lidar, camera, MCU**

## Connections

- Device operator → Standalone runtime: runs (evidence: `README.md`)
- Standalone runtime → Lidar acquisition: starts and scans (evidence: `dev/yoctowatch/src/main.cpp`)
- Standalone runtime → Obstacle detection: clusters scans (evidence: `dev/yoctowatch/src/main.cpp`)
- Standalone runtime → MCU command logic: computes command (evidence: `dev/yoctowatch/src/main.cpp`)
- Standalone runtime → UART communication: sends command (evidence: `dev/yoctowatch/src/main.cpp`)
- Standalone runtime → Camera detection: processes frames (evidence: `dev/yoctowatch/src/main.cpp`)
- Standalone runtime → Sensor fusion: fuses results (evidence: `dev/yoctowatch/src/main.cpp`)
- Camera detection → Detector models: loads model (evidence: `dev/yoctowatch/src/camera.cpp`)
- Lidar acquisition → Lidar, camera, MCU: acquires scans
- Camera detection → Lidar, camera, MCU: captures frames
- UART communication → Lidar, camera, MCU: sends frames
- Device operator → ROS lidar node: runs ROS nodes (evidence: `README.md`)
- Device operator → ROS camera node: runs ROS nodes (evidence: `README.md`)
- ROS lidar node → ROS 2 topics: publishes scans (evidence: `dev/yoctowatch_ros2/src/lidar_node.cpp`)
- ROS camera node → ROS 2 topics: publishes images and detections (evidence: `dev/yoctowatch_ros2/src/camera_node.cpp`)
- ROS 2 topics → rosbridge WebSocket: exposes topics (evidence: `README.md`)
- rosbridge WebSocket → Foxglove client: streams monitoring (evidence: `README.md`)
- Foxglove client → rosbridge WebSocket: publishes messages (evidence: `README.md`)
- Yocto image configuration → Perception app recipes: includes applications
- Perception app recipes → ROS lidar node: deploys ROS application
- Perception app recipes → ROS camera node: deploys ROS application
- Device operator → U-Boot on device: initiates update (evidence: `README.md`)
- U-Boot on device → U-Boot update script: uses update flow (evidence: `README.md`)
- U-Boot on device → Update host services: downloads kernel or rootfs (evidence: `README.md`)
