Skip to content

Commit

Permalink
protect properly max_accel and max_decel (#3952)
Browse files Browse the repository at this point in the history
Co-authored-by: Guillaume Doisy <[email protected]>
  • Loading branch information
2 people authored and SteveMacenski committed Jan 24, 2024
1 parent 31c6ccb commit 6148a76
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 6148a76

Please sign in to comment.