Class EnterRangeEvaluator

Inheritance Relationships

Base Type

Class Documentation

class EnterRangeEvaluator : public ros2_medkit_gateway::ConditionEvaluator

Fires when a numeric value transitions from outside [lower_bound, upper_bound] to inside the range. Both bounds are inclusive. First evaluation (no previous) returns false (needs transition). Requires params: {“lower_bound”: number, “upper_bound”: number}

Public Functions

inline virtual bool evaluate(const std::optional<nlohmann::json> &previous, const nlohmann::json &current, const nlohmann::json &params) const override

Evaluate whether the condition is met.

Parameters:
  • previous – The previous value (nullopt on first evaluation)

  • current – The current value

  • params – Condition-specific parameters (e.g., target_value, bounds)

Pre:

validate_params(params) must have returned success before calling evaluate.

Returns:

true if the condition is met and the trigger should fire

inline virtual tl::expected<void, std::string> validate_params(const nlohmann::json &params) const override

Validate condition parameters before a trigger is created.

Parameters:

params – The parameters to validate

Returns:

void on success, error string on failure