Skip to content

Commit cb34d0c

Browse files
Fix the velocity smoother being stuck when the deadband is too high (ros-navigation#3690)
* Move last_cmd update before deadband * fix lint
1 parent 09eef5c commit cb34d0c

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
@@ -305,13 +305,14 @@ void VelocitySmoother::smootherTimer()
305305
current_.linear.y, command_->linear.y, max_accels_[1], max_decels_[1], eta);
306306
cmd_vel->angular.z = applyConstraints(
307307
current_.angular.z, command_->angular.z, max_accels_[2], max_decels_[2], eta);
308+
last_cmd_ = *cmd_vel;
308309

309310
// Apply deadband restrictions & publish
310311
cmd_vel->linear.x = fabs(cmd_vel->linear.x) < deadband_velocities_[0] ? 0.0 : cmd_vel->linear.x;
311312
cmd_vel->linear.y = fabs(cmd_vel->linear.y) < deadband_velocities_[1] ? 0.0 : cmd_vel->linear.y;
312313
cmd_vel->angular.z = fabs(cmd_vel->angular.z) <
313314
deadband_velocities_[2] ? 0.0 : cmd_vel->angular.z;
314-
last_cmd_ = *cmd_vel;
315+
315316
smoothed_cmd_pub_->publish(std::move(cmd_vel));
316317
}
317318

0 commit comments

Comments
 (0)