Skip to content

Commit 33bebad

Browse files
check that parameter of type double are >=0.0
Signed-off-by: Nils-ChristianIseke <nilsmailiseke@gmail.com>
1 parent 6b51fb2 commit 33bebad

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

nav2_regulated_pure_pursuit_controller/src/parameter_handler.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,17 @@ rcl_interfaces::msg::SetParametersResult ParameterHandler::validateParameterUpda
221221
const auto & name = parameter.get_name();
222222

223223
if (type == ParameterType::PARAMETER_DOUBLE) {
224-
if (name == plugin_name_ + ".inflation_cost_scaling_factor") {
225-
if (parameter.as_double() <= 0.0) {
226-
RCLCPP_WARN(
227-
logger_, "The value inflation_cost_scaling_factor is incorrectly set, "
228-
"it should be >0. Ignoring parameter update.");
229-
result.successful = false;
230-
}
224+
if (name == plugin_name_ + ".inflation_cost_scaling_factor" && parameter.as_double() <= 0.0) {
225+
RCLCPP_WARN(
226+
logger_, "The value inflation_cost_scaling_factor is incorrectly set, "
227+
"it should be >0. Ignoring parameter update.");
228+
result.successful = false;
229+
} else if (parameter.as_double() < 0.0) {
230+
RCLCPP_WARN(
231+
logger_, "The value of parameter '%s' is incorrectly set to %f, "
232+
"it should be >=0. Ignoring parameter update.",
233+
name.c_str(), parameter.as_double());
234+
result.successful = false;
231235
}
232236
} else if (type == ParameterType::PARAMETER_BOOL) {
233237
if (name == plugin_name_ + ".allow_reversing") {

0 commit comments

Comments
 (0)