Skip to content

Commit 5513ff0

Browse files
committed
remove is_not_zero() function
1 parent 79e5ba0 commit 5513ff0

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

control_toolbox/include/control_toolbox/pid.hpp

-6
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ inline bool is_zero(T value, T tolerance = std::numeric_limits<T>::epsilon())
4848
return std::abs(value) <= tolerance;
4949
}
5050

51-
template <typename T>
52-
inline bool is_not_zero(T value, T tolerance = std::numeric_limits<T>::epsilon())
53-
{
54-
return !is_zero(value, tolerance);
55-
}
56-
5751
/***************************************************/
5852
/*! \class Pid
5953
\brief A basic pid class.

control_toolbox/src/pid.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,9 @@ double Pid::compute_command(double error, double error_dot, const double & dt_s)
316316
cmd_ = cmd_unsat_;
317317
}
318318

319-
if (gains.antiwindup_strat_ == "back_calculation" && is_not_zero(gains.i_gain_))
319+
if (gains.antiwindup_strat_ == "back_calculation" && !is_zero(gains.i_gain_))
320320
{
321-
if (is_zero(gains.trk_tc_) && is_not_zero(gains.d_gain_))
321+
if (is_zero(gains.trk_tc_) && !is_zero(gains.d_gain_))
322322
{
323323
// Default value for tracking time constant for back calculation technique
324324
gains.trk_tc_ = std::sqrt(gains.d_gain_ / gains.i_gain_);
@@ -330,7 +330,7 @@ double Pid::compute_command(double error, double error_dot, const double & dt_s)
330330
}
331331
i_term_ += dt_s * (gains.i_gain_ * error + 1 / gains.trk_tc_ * (cmd_ - cmd_unsat_));
332332
}
333-
else if (gains.antiwindup_strat_ == "conditioning_technique" && is_not_zero(gains.i_gain_))
333+
else if (gains.antiwindup_strat_ == "conditioning_technique" && !is_zero(gains.i_gain_))
334334
{
335335
if (is_zero(gains.trk_tc_))
336336
{

0 commit comments

Comments
 (0)