Skip to content

Commit

Permalink
Fix the velocity smoother being stuck when the deadband is too high (r…
Browse files Browse the repository at this point in the history
…os-navigation#3690) (ros-navigation#3715)

* Move last_cmd update before deadband

* fix lint

(cherry picked from commit cb34d0c)

Co-authored-by: BriceRenaudeau <48433002+BriceRenaudeau@users.noreply.github.com>
  • Loading branch information
2 people authored and RBT22 committed Oct 24, 2023
1 parent 79ac958 commit b09bb1b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nav2_velocity_smoother/src/velocity_smoother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,14 @@ void VelocitySmoother::smootherTimer()
current_.linear.y, command_->linear.y, max_accels_[1], max_decels_[1], eta);
cmd_vel->angular.z = applyConstraints(
current_.angular.z, command_->angular.z, max_accels_[2], max_decels_[2], eta);
last_cmd_ = *cmd_vel;

// Apply deadband restrictions & publish
cmd_vel->linear.x = fabs(cmd_vel->linear.x) < deadband_velocities_[0] ? 0.0 : cmd_vel->linear.x;
cmd_vel->linear.y = fabs(cmd_vel->linear.y) < deadband_velocities_[1] ? 0.0 : cmd_vel->linear.y;
cmd_vel->angular.z = fabs(cmd_vel->angular.z) <
deadband_velocities_[2] ? 0.0 : cmd_vel->angular.z;
last_cmd_ = *cmd_vel;

smoothed_cmd_pub_->publish(std::move(cmd_vel));
}

Expand Down

0 comments on commit b09bb1b

Please sign in to comment.