Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PID] Add support for saving i-term when PID is reset #180

Merged
merged 17 commits into from
Jan 23, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Apply suggestions from code review
Co-authored-by: Sai Kishor Kothakota <sai.kishor@pal-robotics.com>
christophfroehlich and saikishor authored Jan 23, 2025
commit 410c61d28d6db519647cb30e95712d9d8b23a3eb
1 change: 1 addition & 0 deletions include/control_toolbox/pid.hpp
Original file line number Diff line number Diff line change
@@ -208,6 +208,7 @@ class Pid

/*!
* \brief Reset the state of this PID controller
* @note The integral term is not retained and it is reset to zero
*/
void reset();

3 changes: 2 additions & 1 deletion include/control_toolbox/pid_ros.hpp
Original file line number Diff line number Diff line change
@@ -125,6 +125,7 @@ class PidROS

/*!
* \brief Reset the state of this PID controller
* @note The integral term is not retained and it is reset to zero
*/
void reset();

@@ -133,7 +134,7 @@ class PidROS
*
* \param save_iterm boolean indicating if integral term is retained on reset()
*/
void reset(bool save_iterm = false);
void reset(bool save_iterm);

/*!
* \brief Set the PID error and compute the PID command with nonuniform time
6 changes: 0 additions & 6 deletions src/pid.cpp
Original file line number Diff line number Diff line change
@@ -93,12 +93,6 @@ void Pid::reset(bool save_iterm)
d_error_ = 0.0;
cmd_ = 0.0;

// If last integral error is already zero, just return
if (std::abs(i_error_) < std::numeric_limits<double>::epsilon())
{
return;
}

// Check to see if we should reset integral error here
if (!save_iterm) clear_saved_iterm();
}