Inconsistent usage of non-numeric validator arguments
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 50/100
Research direction
The bug is in the Python code that generates C++ validation code. Start by finding where bounds validator arguments are emitted—likely in a code generation module or template. Compare with the descriptor initialization code that correctly leaves arguments unquoted. Remove the quoting for non-numeric arguments in the validation path. Run the existing tests to ensure the generated code compiles and behaves correctly.
Written by the indexing model from the issue text.
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?
- Dominant language
- Python
- Stars
- 385
- Forks
- 81
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PickNikRobotics/generate_parameter_library
-
Add ament_cmake_python install instructions to READMEPossibly taken @tylerjw claimed this today. Opendocumentation
Difficulty 1/5 Under an hour Newbie friendliness 72/100
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
PickNikRobotics/generate_parameter_library#392 · 2 comments ·
-
GCC 15 emits -Wfree-nonheap-object for generated string one_of validationPossibly taken @tylerjw claimed this 17 days ago. Open
PickNikRobotics/generate_parameter_library#389 · 1 comment · 1 assignee ·
-
Feature request: math in the yamlPossibly taken @tylerjw claimed this 17 days ago. Open
PickNikRobotics/generate_parameter_library#381 · 2 comments · 1 reaction · 1 assignee ·
-
Validator reference (bounds<>/element_bounds<> etc.) is hard to find inside the READMEPossibly taken @tylerjw claimed this 17 days ago. Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
PickNikRobotics/generate_parameter_library#377 · 1 comment ·
All issues in PickNikRobotics/generate_parameter_library
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
huggingface/sentence-transformers#4186 ·
Maintainers usually reply within 5 days
-
documentation good first issue
Difficulty 2/5 Half a day Newbie friendliness 72/100
sujithputta02/Esapay#13 ·
-
bot-triaged module: correctness (silent) module: mps module: NaNs and Infs triage review
Difficulty 2/5 Half a day Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
SCIInstitute/SCIRun#2842 ·
Maintainers usually reply within 3 days