# carlosmccosta/dynamic_robot_localization architecture

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

- Interactive diagram: https://gitdiagram.com/carlosmccosta/dynamic_robot_localization
- Repository: https://github.com/carlosmccosta/dynamic_robot_localization

## Overview

1. **System boundary**
   - This repository is a ROS C++ package for point-cloud-based localization and mapping.
   - Its core responsibility is to estimate and maintain robot/object pose from 3D sensor data, with optional dynamic map updates through OctoMap.
   - The package is designed as a reusable point-cloud registration library as much as a ROS runtime node.

2. **Primary runtime node**
   - The central executable is `src/localization/localization_node.cpp`, backed by the `localization` module.
   - It consumes sensor clouds and an initial/reference map, runs the localization pipeline, and publishes pose estimates plus diagnostics.
   - A separate `pose_to_tf_publisher` node converts the pose outputs into TF, keeping transform publication decoupled from localization compute time.

3. **Input sources and map provisioning**
   - The system can take raw point clouds from RGB-D/ToF sensors or converted laser scans.
   - The reference map can come from CAD/mesh/PCD files or from ROS topics such as `sensor_msgs/PointCloud2` and `nav_msgs/OccupancyGrid`.
   - This makes the boundary between “environment model” and “online sensor stream” explicit: one side is the reference cloud, the other is the current observation cloud.

4. **Processing pipeline**
   - The architecture is a staged cloud-processing pipeline built from modular components:
     - filters preprocess clouds,
     - analyzers compute geometric/structural properties,
     - matchers estimate alignment,
     - validators decide whether the result is plausible,
     - covariance estimators quantify uncertainty.
   - The pipeline is configurable through YAML rather than hard-coded behavior, so the graph of stages is assembled by configuration.

5. **Cloud filters subsystem**
   - `cloud_filters` contains the preprocessing and segmentation steps used before matching.
   - It includes downsampling, cropping, outlier removal, plane segmentation, clustering, region growing, pass-through, HSV segmentation, and similar operations.
   - These are likely the first major stage in the data flow, reducing noise and extracting the relevant subset of points before registration.

6. **Cloud analysis and feature extraction**
   - `cloud_analyzers`, `normal_estimators`, `curvature_estimators`, and `outlier_detectors` provide intermediate geometric descriptors.
   - These modules support later feature matching by computing normals, curvature, angular distributions, and outlier/quality metrics.
   - They form a shared “feature preparation” layer used by both initial alignment and tracking.

7. **Matching subsystem: initial alignment vs tracking**
   - `cloud_matchers` is split into two major families:
     - **feature matchers** for initial pose estimation and recovery,
     - **point matchers** for continuous tracking.
   - Feature matching includes keypoint detectors and descriptors such as SIFT 3D, ISS3D, PFH, FPFH, SHOT, Spin Image, USC, and ESF, plus sample-consensus alignment variants.
   - Point matching includes ICP variants and NDT variants, including 2D, 3D, generalized, non-linear, and normals-based forms.

8. **Pose acceptance and robustness controls**
   - `transformation_validators` are a distinct gate before pose publication.
   - They reject transformations that violate thresholds such as outlier percentage, inlier RMSE, angular distribution, or translation/rotation correction magnitude.
   - `convergence_estimators` add stopping/quality logic, including time-aware convergence criteria.

9. **Uncertainty and registration quality**
   - `registration_covariance_estimators` compute covariance for point-to-point and point-to-plane alignment, including variants with probabilistic models.
   - This is the boundary where a best-effort pose estimate becomes a pose with quantified confidence.
   - The covariance output is part of the published localization result and can influence downstream decision-making.

10. **Dynamic map update and OctoMap integration**
   - The reference cloud is not fixed; it can be updated with full/inlier/outlier integration modes.
   - OctoMap can be placed in the loop to perform probabilistic occupancy integration on dynamic scenes.
   - This creates a feedback path: localization updates the map, and the updated map becomes the next localization reference.

11. **ROS interfaces and control plane**
   - The package exposes ROS messages in `msg/` for detailed localization state, diagnostics, and timing.
   - ROS services in `srv/` provide control operations such as starting/stopping sensor processing and reloading configuration.
   - This separates the real-time estimation path from operational control and introspection.

12. **Configuration and deployment model**
   - `yaml/configs/` contains scenario-specific presets for 2D/3D, tracking, recovery, pose estimation, filtering, and covariance estimation.
   - `yaml/schema/drl_configs.yaml` defines the configuration contract, which is important for understanding the runtime assembly of modules.
   - Launch files wire together the main node, TF publisher, optional laser-cloud assembler, and optional OctoMap process.

13. **Utility and offline tooling**
   - `src/tools/mesh_to_pcd.cpp` and scripts under `tools/` support offline conversion of meshes/CAD models into point clouds.
   - The docs emphasize uniform surface density, so the offline conversion pipeline is part of the architecture, not just a convenience.
   - This preprocessing stage feeds the reference-map boundary and directly affects registration quality.

14. **Implementation style and dependencies**
   - The code is organized as headers in `include/` with implementation in `src/`, suggesting a reusable library plus ROS nodes.
   - The primary external technologies that materially shape the architecture are ROS, PCL, TF, and OctoMap.
   - Overall, the repository is a modular perception stack for cloud registration and localization, with configurable pipelines and a clear separation between preprocessing, matching, validation, and map maintenance.

Main entry points: [`include/dynamic_robot_localization/localization/localization.h`](https://github.com/carlosmccosta/dynamic_robot_localization/blob/noetic-devel/include/dynamic_robot_localization/localization/localization.h) (Localization core), [`src/localization/localization_node.cpp`](https://github.com/carlosmccosta/dynamic_robot_localization/blob/noetic-devel/src/localization/localization_node.cpp) (Localization node), [`include/dynamic_robot_localization/cloud_matchers`](https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/cloud_matchers) (Cloud matchers), [`launch/octo_map.launch`](https://github.com/carlosmccosta/dynamic_robot_localization/blob/noetic-devel/launch/octo_map.launch) (OctoMap update)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_runtime["Runtime"]
  node_node_localization_node["Localization node<br/>ROS runtime"]
  node_node_localization_core["Localization core<br/>[localization.h]"]
  node_node_pose_tf["TF publisher<br/>ROS node"]
end

subgraph group_group_pipeline["Pipeline"]
  node_node_filters["Cloud filters<br/>preprocess"]
  node_node_analyzers["Cloud analyzers<br/>features"]
  node_node_normals["Normal estimators<br/>features"]
  node_node_curvature["Curvature estimators<br/>features"]
  node_node_outliers["Outlier detectors<br/>quality"]
  node_node_matchers["Cloud matchers<br/>registration"]
  node_node_feature_matchers["Feature matchers<br/>initial alignment"]
  node_node_point_matchers["Point matchers<br/>tracking"]
  node_node_validators["Pose validators<br/>gate"]
  node_node_convergence["Convergence<br/>stopping"]
  node_node_covariance["Covariance estimators<br/>uncertainty"]
end

subgraph group_group_map["Map & Update"]
  node_node_map_sources[("Map inputs<br/>reference model")]
  node_node_octomap["OctoMap update<br/>dynamic map<br/>[octo_map.launch]"]
end

subgraph group_group_support["Support"]
  node_node_ros_msgs["ROS messages<br/>interface"]
  node_node_ros_srvs["ROS services<br/>control"]
  node_node_yaml["YAML configs<br/>configuration<br/>[drl_configs.yaml]"]
  node_node_mesh_tools["Mesh tools<br/>offline tooling<br/>[mesh_to_pcd.cpp]"]
end

node_node_localization_node -->|"runs"| node_node_localization_core
node_node_localization_node -->|"publishes"| node_node_ros_msgs
node_node_localization_node -->|"controlled by"| node_node_ros_srvs
node_node_localization_core -->|"preprocesses"| node_node_filters
node_node_localization_core -->|"analyzes"| node_node_analyzers
node_node_localization_core -->|"estimates normals"| node_node_normals
node_node_localization_core -->|"extracts curvature"| node_node_curvature
node_node_localization_core -->|"scores noise"| node_node_outliers
node_node_localization_core -->|"registers"| node_node_matchers
node_node_matchers -->|"initial pose"| node_node_feature_matchers
node_node_matchers -->|"tracking pose"| node_node_point_matchers
node_node_localization_core -->|"checks pose"| node_node_validators
node_node_validators -->|"uses"| node_node_convergence
node_node_localization_core -->|"estimates uncertainty"| node_node_covariance
node_node_localization_core -->|"consumes"| node_node_map_sources
node_node_localization_core -->|"updates"| node_node_octomap
node_node_octomap -->|"refreshes"| node_node_map_sources
node_node_mesh_tools -->|"creates"| node_node_map_sources
node_node_yaml -->|"configures"| node_node_localization_core
node_node_yaml -->|"configures"| node_node_octomap
node_node_ros_msgs -->|"feeds"| node_node_pose_tf
node_node_localization_node -->|"publishes pose"| node_node_pose_tf

click node_node_localization_node "https://github.com/carlosmccosta/dynamic_robot_localization/blob/noetic-devel/src/localization/localization_node.cpp"
click node_node_localization_core "https://github.com/carlosmccosta/dynamic_robot_localization/blob/noetic-devel/include/dynamic_robot_localization/localization/localization.h"
click node_node_filters "https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/cloud_filters"
click node_node_analyzers "https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/cloud_analyzers"
click node_node_normals "https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/normal_estimators"
click node_node_curvature "https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/curvature_estimators"
click node_node_outliers "https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/outlier_detectors"
click node_node_matchers "https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/cloud_matchers"
click node_node_feature_matchers "https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/cloud_matchers/feature_matchers"
click node_node_point_matchers "https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/cloud_matchers/point_matchers"
click node_node_validators "https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/transformation_validators"
click node_node_convergence "https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/convergence_estimators"
click node_node_covariance "https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/registration_covariance_estimators"
click node_node_octomap "https://github.com/carlosmccosta/dynamic_robot_localization/blob/noetic-devel/launch/octo_map.launch"
click node_node_ros_msgs "https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/msg"
click node_node_ros_srvs "https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/srv"
click node_node_yaml "https://github.com/carlosmccosta/dynamic_robot_localization/blob/noetic-devel/yaml/schema/drl_configs.yaml"
click node_node_mesh_tools "https://github.com/carlosmccosta/dynamic_robot_localization/blob/noetic-devel/src/tools/mesh_to_pcd.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_node_localization_node,node_node_localization_core,node_node_pose_tf toneBlue
class node_node_filters,node_node_analyzers,node_node_normals,node_node_curvature,node_node_outliers,node_node_matchers,node_node_feature_matchers,node_node_point_matchers,node_node_validators,node_node_convergence,node_node_covariance toneAmber
class node_node_map_sources,node_node_octomap toneMint
class node_node_ros_msgs,node_node_ros_srvs,node_node_yaml,node_node_mesh_tools toneRose
```

## Components

### Runtime

ROS nodes and the localization execution path

- [Localization node](https://github.com/carlosmccosta/dynamic_robot_localization/blob/noetic-devel/src/localization/localization_node.cpp): ROS runtime · Main executable that runs localization from sensor clouds and a reference map. · `src/localization/localization_node.cpp`
- [Localization core](https://github.com/carlosmccosta/dynamic_robot_localization/blob/noetic-devel/include/dynamic_robot_localization/localization/localization.h): library · Reusable localization module that orchestrates the estimation pipeline. · `include/dynamic_robot_localization/localization/localization.h`
- **TF publisher**: ROS node · Converts estimated poses into TF transforms.

### Pipeline

Cloud preprocessing, analysis, matching, and validation

- [Cloud filters](https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/cloud_filters): preprocess · Downsampling, cropping, segmentation, and outlier removal before registration. · `include/dynamic_robot_localization/cloud_filters`
- [Cloud analyzers](https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/cloud_analyzers): features · Computes structural descriptors used by downstream matching. · `include/dynamic_robot_localization/cloud_analyzers`
- [Normal estimators](https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/normal_estimators): features · Normal estimation backends used by feature preparation and point-to-plane methods. · `include/dynamic_robot_localization/normal_estimators`
- [Curvature estimators](https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/curvature_estimators): features · Principal curvature extraction for geometric characterization. · `include/dynamic_robot_localization/curvature_estimators`
- [Outlier detectors](https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/outlier_detectors): quality · Detects noisy or inconsistent points for filtering and scoring. · `include/dynamic_robot_localization/outlier_detectors`
- [Cloud matchers](https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/cloud_matchers): registration · Registration layer split into feature-based initial alignment and point-based tracking. · `include/dynamic_robot_localization/cloud_matchers`
- [Feature matchers](https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/cloud_matchers/feature_matchers): initial alignment · Keypoint/descriptor registration and sample-consensus alignment for pose recovery. · `include/dynamic_robot_localization/cloud_matchers/feature_matchers`
- [Point matchers](https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/cloud_matchers/point_matchers): tracking · ICP and NDT variants for continuous pose tracking. · `include/dynamic_robot_localization/cloud_matchers/point_matchers`
- [Pose validators](https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/transformation_validators): gate · Rejects implausible transformations before publication. · `include/dynamic_robot_localization/transformation_validators`
- [Convergence](https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/convergence_estimators): stopping · Convergence and timing-aware quality criteria for registration loops. · `include/dynamic_robot_localization/convergence_estimators`
- [Covariance estimators](https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/include/dynamic_robot_localization/registration_covariance_estimators): uncertainty · Computes registration covariance and pose confidence. · `include/dynamic_robot_localization/registration_covariance_estimators`

### Map & Update

Reference map provisioning and dynamic map maintenance

- **Map inputs**: reference model · Reference clouds from CAD, mesh, PCD, PointCloud2, or OccupancyGrid sources.
- [OctoMap update](https://github.com/carlosmccosta/dynamic_robot_localization/blob/noetic-devel/launch/octo_map.launch): dynamic map · Probabilistic occupancy integration and dynamic reference map maintenance. · `launch/octo_map.launch`

### Support

Configuration, ROS interfaces, and offline tooling

- [ROS messages](https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/msg): interface · Localization state, diagnostics, timings, and configuration messages. · `msg`
- [ROS services](https://github.com/carlosmccosta/dynamic_robot_localization/tree/noetic-devel/srv): control · Start/stop sensor processing and reload configuration. · `srv`
- [YAML configs](https://github.com/carlosmccosta/dynamic_robot_localization/blob/noetic-devel/yaml/schema/drl_configs.yaml): configuration · Scenario presets and schema that assemble the runtime pipeline. · `yaml/schema/drl_configs.yaml`
- [Mesh tools](https://github.com/carlosmccosta/dynamic_robot_localization/blob/noetic-devel/src/tools/mesh_to_pcd.cpp): offline tooling · Mesh-to-PCD conversion and surface preparation for reference maps. · `src/tools/mesh_to_pcd.cpp`

## Connections

- Localization node → Localization core: runs · The main node delegates estimation to the reusable localization library.
- Localization node → ROS messages: publishes · Emits detailed localization state, diagnostics, and timing output.
- Localization node → ROS services: controlled by · Runtime processing can be started, stopped, or reconfigured via services.
- Localization core → Cloud filters: preprocesses · Incoming sensor and reference clouds are filtered before registration.
- Localization core → Cloud analyzers: analyzes · Extracts geometric descriptors and quality signals from clouds.
- Localization core → Normal estimators: estimates normals · Normal computation feeds feature extraction and point-to-plane matching.
- Localization core → Curvature estimators: extracts curvature · Curvature features support structural description and matching.
- Localization core → Outlier detectors: scores noise · Outlier detection supports cloud cleanup and registration quality.
- Localization core → Cloud matchers: registers · Performs pose estimation through registration matchers.
- Cloud matchers → Feature matchers: initial pose · Feature-based alignment is used for initialization and recovery.
- Cloud matchers → Point matchers: tracking pose · Point-based methods are used for continuous pose tracking.
- Localization core → Pose validators: checks pose · Candidate transforms are validated before acceptance.
- Pose validators → Convergence: uses · Convergence logic contributes to acceptance and stopping decisions.
- Localization core → Covariance estimators: estimates uncertainty · Registration covariance is computed alongside the pose estimate.
- Localization core → Map inputs: consumes · Localization operates against a reference map or environment model.
- Localization core → OctoMap update: updates · Dynamic scenes can feed back into probabilistic map maintenance.
- OctoMap update → Map inputs: refreshes · Updated occupancy information becomes the next reference context.
- Mesh tools → Map inputs: creates · Offline mesh conversion produces point-cloud maps for localization.
- YAML configs → Localization core: configures · YAML presets assemble filters, matchers, validators, and covariance modules.
- YAML configs → OctoMap update: configures · Launch and config files control optional map integration.
- ROS messages → TF publisher: feeds · Pose outputs are converted into TF by a separate node.
- Localization node → TF publisher: publishes pose · Pose estimates are the input to TF publication.
