From 6148a76308e7230bf52d262aa7ca70279e10cb63 Mon Sep 17 00:00:00 2001 From: Guillaume Doisy Date: Fri, 10 Nov 2023 10:02:32 -0700 Subject: [PATCH] protect properly max_accel and max_decel (#3952) Co-authored-by: Guillaume Doisy --- nav2_velocity_smoother/src/velocity_smoother.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nav2_velocity_smoother/src/velocity_smoother.cpp b/nav2_velocity_smoother/src/velocity_smoother.cpp index 36ae066b6d..1c86659aae 100644 --- a/nav2_velocity_smoother/src/velocity_smoother.cpp +++ b/nav2_velocity_smoother/src/velocity_smoother.cpp @@ -401,7 +401,9 @@ VelocitySmoother::dynamicParametersCallback(std::vector param result.successful = false; } } - max_accels_ = parameter.as_double_array(); + if (result.successful) { + max_accels_ = parameter.as_double_array(); + } } else if (name == "max_decel") { for (unsigned int i = 0; i != 3; i++) { if (parameter.as_double_array()[i] > 0.0) { @@ -411,7 +413,9 @@ VelocitySmoother::dynamicParametersCallback(std::vector param result.successful = false; } } - max_decels_ = parameter.as_double_array(); + if (result.successful) { + max_decels_ = parameter.as_double_array(); + } } else if (name == "deadband_velocity") { deadband_velocities_ = parameter.as_double_array(); }