Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Dr. Denis <[email protected]>
  • Loading branch information
Whalex451 and destogl committed Feb 11, 2024
1 parent 3aaab38 commit 2fa429a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/control_toolbox/pid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class CONTROL_TOOLBOX_PUBLIC Pid
*/
struct Gains
{
// Optional constructor for passing in values without antiwindup/save i-term
// Optional constructor for passing in values without antiwindup and save i-term
Gains(double p, double i, double d, double i_max, double i_min)
: p_gain_(p), i_gain_(i), d_gain_(d), i_max_(i_max), i_min_(i_min), antiwindup_(false),
save_iterm_(false)
Expand Down
7 changes: 5 additions & 2 deletions src/pid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ void Pid::reset()
cmd_ = 0.0;

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

// Get the gain parameters from the realtime buffer
Gains gains = *gains_buffer_.readFromRT();
Expand All @@ -111,7 +114,7 @@ void Pid::getGains(double & p, double & i, double & d, double & i_max, double &

void Pid::getGains(
double & p, double & i, double & d, double & i_max, double & i_min, bool & antiwindup,
bool &save_iterm)
bool & save_iterm)
{
Gains gains = *gains_buffer_.readFromRT();

Expand Down

0 comments on commit 2fa429a

Please sign in to comment.