# hkkwww/mower_ws architecture

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

- Interactive diagram: https://gitdiagram.com/hkkwww/mower_ws
- Repository: https://github.com/hkkwww/mower_ws

## Overview

This is a ROS 2 software stack for a mower robot. The documented bring-up workflow starts IMU and lidar sensing, chassis velocity control and odometry/TF, then combines the robot description with SLAM and Navigation2; maps can be saved and loaded separately. The graph preserves the sensor, control, mapping, and navigation stages plus the lidar SDK’s decoding layer. Several package configurations and source implementations were not sampled, so only documented or indexed relationships are connected.

Main entry points: [`src/navigation2_pkg/launch/mower_nav.launch.py`](https://github.com/hkkwww/mower_ws/blob/main/src/navigation2_pkg/launch/mower_nav.launch.py) (Navigation bring-up), [`src/rplidar_ros/sdk/src/dataunpacker/dataunpacker.h`](https://github.com/hkkwww/mower_ws/blob/main/src/rplidar_ros/sdk/src/dataunpacker/dataunpacker.h) (Sample unpacker), [`src/navigation2_pkg/launch/navigation2.launch.py`](https://github.com/hkkwww/mower_ws/blob/main/src/navigation2_pkg/launch/navigation2.launch.py) (Map save and load), [`src/rplidar_ros/sdk/src/sl_lidar_driver.cpp`](https://github.com/hkkwww/mower_ws/blob/main/src/rplidar_ros/sdk/src/sl_lidar_driver.cpp) (Lidar driver API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensing["Sensing"]
  node_imu["IMU driver<br/>[wit_ros2_imu.py]"]
  node_lidar_ros["Lidar ROS node<br/>[rplidar_node.cpp]"]
  node_lidar_launch["Lidar launch"]
end

subgraph group_mobility["Mobility"]
  node_robot_control["Velocity control"]
  node_odom_tf["Odometry and TF"]
  node_control_launch["Control launch"]
  node_description["Robot description"]
end

subgraph group_mapping["Mapping"]
  node_bringup["Navigation bring-up"]
  node_slam["SLAM<br/>[slam.launch.py]"]
  node_cartographer_launch["Cartographer launch"]
  node_navigation["Navigation2"]
  node_map_ops["Map save and load"]
  node_map_store[("Map files")]
end

subgraph group_lidar_sdk["Lidar SDK"]
  node_lidar_driver["Lidar driver API"]
  node_sample_unpacker["Sample unpacker<br/>[dataunpacker.h]"]
  node_capsule_decode["Capsule decoders"]
  node_normal_decode["Normal decoder"]
  node_hq_decode["HQ decoder<br/>[handler_hqnode.cpp]"]
end

node_operator(("Robot operator"))

node_operator -->|"starts stack"| node_bringup
node_bringup -->|"starts"| node_imu
node_bringup -->|"includes"| node_lidar_launch
node_bringup -->|"starts"| node_robot_control
node_bringup -->|"starts"| node_odom_tf
node_bringup -->|"includes"| node_description
node_bringup -->|"includes"| node_navigation
node_operator -->|"starts control"| node_control_launch
node_operator -->|"starts mapping"| node_slam
node_operator -->|"starts Cartographer"| node_cartographer_launch
node_operator -->|"saves or loads"| node_map_ops
node_map_ops -->|"reads and writes"| node_map_store
node_lidar_driver -->|"uses"| node_sample_unpacker
node_capsule_decode -->|"implements handler"| node_sample_unpacker
node_normal_decode -->|"implements handler"| node_sample_unpacker
node_hq_decode -->|"implements handler"| node_sample_unpacker
node_lidar_ros -.->|"uses SDK"| node_lidar_driver

click node_bringup "https://github.com/hkkwww/mower_ws/blob/main/src/navigation2_pkg/launch/mower_nav.launch.py"
click node_imu "https://github.com/hkkwww/mower_ws/blob/main/src/wit_ros2_imu/wit_ros2_imu/wit_ros2_imu.py"
click node_lidar_ros "https://github.com/hkkwww/mower_ws/blob/main/src/rplidar_ros/src/rplidar_node.cpp"
click node_lidar_launch "https://github.com/hkkwww/mower_ws/blob/main/src/rplidar_ros/launch/rplidar_a2m8_launch.py"
click node_robot_control "https://github.com/hkkwww/mower_ws/blob/main/src/robot_control_pkg/robot_control_pkg/robot_control_node.py"
click node_odom_tf "https://github.com/hkkwww/mower_ws/blob/main/src/robot_control_pkg/robot_control_pkg/pub_odom_tf_node.py"
click node_control_launch "https://github.com/hkkwww/mower_ws/blob/main/src/robot_control_pkg/launch/robot_control.launch.py"
click node_description "https://github.com/hkkwww/mower_ws/blob/main/src/mower_description/launch/mower_description.launch.py"
click node_slam "https://github.com/hkkwww/mower_ws/blob/main/src/cartographer_pkg/launch/slam.launch.py"
click node_cartographer_launch "https://github.com/hkkwww/mower_ws/blob/main/src/cartographer_pkg/launch/cartographer.launch.py"
click node_navigation "https://github.com/hkkwww/mower_ws/blob/main/src/navigation2_pkg/launch/navigation2.launch.py"
click node_map_ops "https://github.com/hkkwww/mower_ws/blob/main/src/navigation2_pkg/launch/navigation2.launch.py"
click node_lidar_driver "https://github.com/hkkwww/mower_ws/blob/main/src/rplidar_ros/sdk/src/sl_lidar_driver.cpp"
click node_sample_unpacker "https://github.com/hkkwww/mower_ws/blob/main/src/rplidar_ros/sdk/src/dataunpacker/dataunpacker.h"
click node_capsule_decode "https://github.com/hkkwww/mower_ws/blob/main/src/rplidar_ros/sdk/src/dataunpacker/unpacker/handler_capsules.cpp"
click node_normal_decode "https://github.com/hkkwww/mower_ws/blob/main/src/rplidar_ros/sdk/src/dataunpacker/unpacker/handler_normalnode.cpp"
click node_hq_decode "https://github.com/hkkwww/mower_ws/blob/main/src/rplidar_ros/sdk/src/dataunpacker/unpacker/handler_hqnode.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_imu,node_lidar_ros,node_lidar_launch toneBlue
class node_robot_control,node_odom_tf,node_control_launch,node_description toneAmber
class node_bringup,node_slam,node_cartographer_launch,node_navigation,node_map_ops,node_map_store toneMint
class node_lidar_driver,node_sample_unpacker,node_capsule_decode,node_normal_decode,node_hq_decode toneRose
class node_operator toneIndigo
```

## Components

### Sensing

- [IMU driver](https://github.com/hkkwww/mower_ws/blob/main/src/wit_ros2_imu/wit_ros2_imu/wit_ros2_imu.py): `src/wit_ros2_imu/wit_ros2_imu/wit_ros2_imu.py`
- [Lidar ROS node](https://github.com/hkkwww/mower_ws/blob/main/src/rplidar_ros/src/rplidar_node.cpp): `src/rplidar_ros/src/rplidar_node.cpp`
- [Lidar launch](https://github.com/hkkwww/mower_ws/blob/main/src/rplidar_ros/launch/rplidar_a2m8_launch.py): `src/rplidar_ros/launch/rplidar_a2m8_launch.py`

### Mobility

- [Velocity control](https://github.com/hkkwww/mower_ws/blob/main/src/robot_control_pkg/robot_control_pkg/robot_control_node.py): `src/robot_control_pkg/robot_control_pkg/robot_control_node.py`
- [Odometry and TF](https://github.com/hkkwww/mower_ws/blob/main/src/robot_control_pkg/robot_control_pkg/pub_odom_tf_node.py): `src/robot_control_pkg/robot_control_pkg/pub_odom_tf_node.py`
- [Control launch](https://github.com/hkkwww/mower_ws/blob/main/src/robot_control_pkg/launch/robot_control.launch.py): `src/robot_control_pkg/launch/robot_control.launch.py`
- [Robot description](https://github.com/hkkwww/mower_ws/blob/main/src/mower_description/launch/mower_description.launch.py): `src/mower_description/launch/mower_description.launch.py`

### Mapping

- [Navigation bring-up](https://github.com/hkkwww/mower_ws/blob/main/src/navigation2_pkg/launch/mower_nav.launch.py): `src/navigation2_pkg/launch/mower_nav.launch.py`
- [SLAM](https://github.com/hkkwww/mower_ws/blob/main/src/cartographer_pkg/launch/slam.launch.py): `src/cartographer_pkg/launch/slam.launch.py`
- [Cartographer launch](https://github.com/hkkwww/mower_ws/blob/main/src/cartographer_pkg/launch/cartographer.launch.py): `src/cartographer_pkg/launch/cartographer.launch.py`
- [Navigation2](https://github.com/hkkwww/mower_ws/blob/main/src/navigation2_pkg/launch/navigation2.launch.py): `src/navigation2_pkg/launch/navigation2.launch.py`
- [Map save and load](https://github.com/hkkwww/mower_ws/blob/main/src/navigation2_pkg/launch/navigation2.launch.py): `src/navigation2_pkg/launch/navigation2.launch.py`
- **Map files**

### Lidar SDK

- [Lidar driver API](https://github.com/hkkwww/mower_ws/blob/main/src/rplidar_ros/sdk/src/sl_lidar_driver.cpp): `src/rplidar_ros/sdk/src/sl_lidar_driver.cpp`
- [Sample unpacker](https://github.com/hkkwww/mower_ws/blob/main/src/rplidar_ros/sdk/src/dataunpacker/dataunpacker.h): `src/rplidar_ros/sdk/src/dataunpacker/dataunpacker.h`
- [Capsule decoders](https://github.com/hkkwww/mower_ws/blob/main/src/rplidar_ros/sdk/src/dataunpacker/unpacker/handler_capsules.cpp): `src/rplidar_ros/sdk/src/dataunpacker/unpacker/handler_capsules.cpp`
- [Normal decoder](https://github.com/hkkwww/mower_ws/blob/main/src/rplidar_ros/sdk/src/dataunpacker/unpacker/handler_normalnode.cpp): `src/rplidar_ros/sdk/src/dataunpacker/unpacker/handler_normalnode.cpp`
- [HQ decoder](https://github.com/hkkwww/mower_ws/blob/main/src/rplidar_ros/sdk/src/dataunpacker/unpacker/handler_hqnode.cpp): `src/rplidar_ros/sdk/src/dataunpacker/unpacker/handler_hqnode.cpp`

### Other components

- **Robot operator**

## Connections

- Robot operator → Navigation bring-up: starts stack
- Navigation bring-up → IMU driver: starts (evidence: `src/navigation2_pkg/launch/mower_nav.launch.py`)
- Navigation bring-up → Lidar launch: includes (evidence: `src/navigation2_pkg/launch/mower_nav.launch.py`)
- Navigation bring-up → Velocity control: starts (evidence: `src/navigation2_pkg/launch/mower_nav.launch.py`)
- Navigation bring-up → Odometry and TF: starts (evidence: `src/navigation2_pkg/launch/mower_nav.launch.py`)
- Navigation bring-up → Robot description: includes (evidence: `src/navigation2_pkg/launch/mower_nav.launch.py`)
- Navigation bring-up → Navigation2: includes (evidence: `src/navigation2_pkg/launch/mower_nav.launch.py`)
- Robot operator → Control launch: starts control
- Robot operator → SLAM: starts mapping
- Robot operator → Cartographer launch: starts Cartographer
- Robot operator → Map save and load: saves or loads
- Map save and load → Map files: reads and writes
- Lidar driver API → Sample unpacker: uses (evidence: `src/rplidar_ros/sdk/src/sl_lidar_driver.cpp`)
- Capsule decoders → Sample unpacker: implements handler (evidence: `src/rplidar_ros/sdk/src/dataunpacker/unpacker/handler_capsules.cpp`)
- Normal decoder → Sample unpacker: implements handler (evidence: `src/rplidar_ros/sdk/src/dataunpacker/unpacker/handler_normalnode.cpp`)
- HQ decoder → Sample unpacker: implements handler (evidence: `src/rplidar_ros/sdk/src/dataunpacker/unpacker/handler_hqnode.cpp`)
- Lidar ROS node → Lidar driver API: uses SDK
