Skip to content

Commit 4f640e1

Browse files
Merge branch 'ros2-master' into pid/prefix
2 parents 172ac21 + 4504fcf commit 4f640e1

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

control_toolbox/include/control_toolbox/pid.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ struct AntiWindupStrategy
143143
"{})",
144144
i_min, i_max));
145145
}
146-
if (std::isfinite(i_min) || std::isfinite(i_max))
146+
if (type != LEGACY && (std::isfinite(i_min) || std::isfinite(i_max)))
147147
{
148148
std::cout << "Warning: The i_min and i_max are only valid for the deprecated LEGACY "
149149
"antiwindup strategy. Please use the AntiWindupStrategy::set_type() method to "

control_toolbox/src/pid.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ bool Pid::set_gains(const Gains & gains_in)
230230
std::string error_msg = "";
231231
if (!gains_in.validate(error_msg))
232232
{
233-
std::cerr << "PID: Invalid gains: " << error_msg << ". SKipping new gains." << std::endl;
233+
std::cerr << "PID: Invalid gains: " << error_msg << ". Skipping new gains." << std::endl;
234234
return false;
235235
}
236236
else
@@ -417,6 +417,11 @@ double Pid::compute_command(double error, double error_dot, const double & dt_s)
417417
i_term_ += dt_s * gains_.i_gain_ * error;
418418
}
419419
}
420+
else if (gains_.antiwindup_strat_.type == AntiWindupStrategy::NONE)
421+
{
422+
// No anti-windup strategy, so just integrate the error
423+
i_term_ += dt_s * gains_.i_gain_ * error;
424+
}
420425
}
421426

422427
return cmd_;

0 commit comments

Comments
 (0)