Skip to content

Commit

Permalink
protect properly max_accel and max_decel (ros-navigation#3952)
Browse files Browse the repository at this point in the history
Co-authored-by: Guillaume Doisy <[email protected]>
Signed-off-by: enricosutera <[email protected]>
  • Loading branch information
2 people authored and enricosutera committed May 19, 2024
1 parent 5fa0911 commit d516377
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nav2_velocity_smoother/src/velocity_smoother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,9 @@ VelocitySmoother::dynamicParametersCallback(std::vector<rclcpp::Parameter> 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) {
Expand All @@ -411,7 +413,9 @@ VelocitySmoother::dynamicParametersCallback(std::vector<rclcpp::Parameter> 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();
}
Expand Down

0 comments on commit d516377

Please sign in to comment.