File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4545
4646namespace control_toolbox
4747{
48- template <typename T>
49- inline bool is_zero (T value, T tolerance = std::numeric_limits<T>::epsilon())
50- {
51- return std::abs (value) <= tolerance;
52- }
53-
5448/* *
5549 * \brief Antiwindup strategy for PID controllers.
5650 *
@@ -113,14 +107,14 @@ struct AntiWindupStrategy
113107 }
114108 }
115109
116- void validate (const double i_gain ) const
110+ void validate () const
117111 {
118112 if (type == UNDEFINED)
119113 {
120114 throw std::invalid_argument (" AntiWindupStrategy is UNDEFINED. Please set a valid type" );
121115 }
122116 if (
123- type == BACK_CALCULATION && ! is_zero (i_gain) &&
117+ type == BACK_CALCULATION &&
124118 (tracking_time_constant < 0.0 || !std::isfinite (tracking_time_constant)))
125119 {
126120 throw std::invalid_argument (
@@ -174,6 +168,12 @@ struct AntiWindupStrategy
174168 std::numeric_limits<double >::epsilon(); /* *< Error deadband to avoid integration. */
175169};
176170
171+ template <typename T>
172+ inline bool is_zero (T value, T tolerance = std::numeric_limits<T>::epsilon())
173+ {
174+ return std::abs (value) <= tolerance;
175+ }
176+
177177/* **************************************************/
178178/* !
179179 \class Pid
@@ -316,7 +316,7 @@ class Pid
316316 }
317317 try
318318 {
319- antiwindup_strat_.validate (i_gain_ );
319+ antiwindup_strat_.validate ();
320320 }
321321 catch (const std::exception & e)
322322 {
Original file line number Diff line number Diff line change @@ -207,7 +207,7 @@ bool PidROS::initialize_from_ros_parameters()
207207
208208 try
209209 {
210- antiwindup_strat.validate (i );
210+ antiwindup_strat.validate ();
211211 }
212212 catch (const std::exception & e)
213213 {
You can’t perform that action at this time.
0 commit comments