Skip to content

Commit 123e367

Browse files
Fix the velocity smoother being stuck when the deadband is too high (#3690) (#3714)
* Move last_cmd update before deadband * fix lint (cherry picked from commit cb34d0c) Co-authored-by: BriceRenaudeau <[email protected]>
1 parent d79c210 commit 123e367

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

nav2_velocity_smoother/src/velocity_smoother.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,14 @@ void VelocitySmoother::smootherTimer()
299299
current_.linear.y, command_->linear.y, max_accels_[1], max_decels_[1], eta);
300300
cmd_vel->angular.z = applyConstraints(
301301
current_.angular.z, command_->angular.z, max_accels_[2], max_decels_[2], eta);
302+
last_cmd_ = *cmd_vel;
302303

303304
// Apply deadband restrictions & publish
304305
cmd_vel->linear.x = fabs(cmd_vel->linear.x) < deadband_velocities_[0] ? 0.0 : cmd_vel->linear.x;
305306
cmd_vel->linear.y = fabs(cmd_vel->linear.y) < deadband_velocities_[1] ? 0.0 : cmd_vel->linear.y;
306307
cmd_vel->angular.z = fabs(cmd_vel->angular.z) <
307308
deadband_velocities_[2] ? 0.0 : cmd_vel->angular.z;
308-
last_cmd_ = *cmd_vel;
309+
309310
smoothed_cmd_pub_->publish(std::move(cmd_vel));
310311
}
311312

0 commit comments

Comments
 (0)