-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
I would like to refer to variables that I already have in code (in an underlying driver library) to define bounds of a parameter.
I.e., doing something like this
gain:
type: double
default_value: 0.0
read_only: false
description: "The amplifier gain in dB"
validation:
bounds<>: [device_params::Gain::min, device_params::Gain::max]In the generated header file, it does work how I want it at the declaration of the parameter: it puts the unquoted arguments there, resulting in properly working code:
descriptor.read_only = false;
descriptor.floating_point_range.resize(1);
descriptor.floating_point_range.at(0).from_value = device_params::Gain::min;
descriptor.floating_point_range.at(0).to_value = device_params::Gain::max;However, at the validation part of the generated code, it quotes the arguments, leading to compile errors:
param = parameters_interface_->get_parameter(prefix_ + "gain");
RCLCPP_DEBUG_STREAM(logger_, param.get_name() << ": " << param.get_type_name() << " = " << param.value_to_string());
if(auto validation_result = bounds<double>(param, "device_params::Gain::min", "device_params::Gain::max"); validation_result) {
throw rclcpp::exceptions::InvalidParameterValueException(fmt::format("Invalid value set during initialization for parameter 'gain': {}", validation_result.error()));
}Could it be an easy fix if it's just the quoting?
Metadata
Metadata
Assignees
Labels
No labels