Class EntityThresholdResolver

Class Documentation

class EntityThresholdResolver

Resolves per-entity debounce thresholds using longest-prefix matching.

Given a source_id (entity FQN like “/powertrain/motor_left”) and the global DebounceConfig, returns a merged config where entity-specific overrides take precedence over global defaults.

Public Functions

EntityThresholdResolver() = default
explicit EntityThresholdResolver(std::vector<EntityDebounceOverride> entries)

Construct with a list of entity overrides. Entries are sorted internally by prefix length (longest first) for efficient matching.

DebounceConfig resolve(const std::string &source_id, const DebounceConfig &global_default) const

Resolve effective DebounceConfig for a given source_id. Finds the longest prefix match among entries and merges with global_default. If no match, returns global_default unchanged.

size_t size() const

Number of configured entity entries.

Public Static Functions

static std::vector<EntityDebounceOverride> load_from_yaml(const std::string &path)

Load entity threshold overrides from a YAML file. Returns an empty vector on parse error (logs warning via rcutils). YAML format: map of entity prefix -> {confirmation_threshold, healing_enabled, healing_threshold}