@@ -92,13 +92,14 @@ class PidROS
9292 * \param d The derivative gain.
9393 * \param i_max Upper integral clamp.
9494 * \param i_min Lower integral clamp.
95- * \param antiwindup Antiwindup functionality. When set to true, limits
95+ * \param antiwindup Anti-windup functionality. When set to true, limits
9696 the integral error to prevent windup; otherwise, constrains the
9797 integral contribution to the control output. i_max and
9898 i_min are applied in both scenarios.
9999 *
100100 * \note New gains are not applied if i_min_ > i_max_
101101 */
102+ [[deprecated(" Use initialize_from_args with AntiwindupStrategy instead." )]]
102103 void initialize_from_args(
103104 double p, double i, double d, double i_max, double i_min, bool antiwindup);
104105
@@ -125,11 +126,15 @@ class PidROS
125126 * \param d The derivative gain.
126127 * \param i_max The max integral windup.
127128 * \param i_min The min integral windup.
128- * \param antiwindup antiwindup.
129+ * \param antiwindup Anti-windup functionality. When set to true, limits
130+ the integral error to prevent windup; otherwise, constrains the
131+ integral contribution to the control output. i_max and
132+ i_min are applied in both scenarios.
129133 * \param save_i_term save integrator output between resets.
130134 *
131135 * \note New gains are not applied if i_min_ > i_max_
132136 */
137+ [[deprecated(" Use initialize_from_args with AntiwindupStrategy instead." )]]
133138 void initialize_from_args (
134139 double p, double i, double d, double i_max, double i_min, bool antiwindup, bool save_i_term);
135140
@@ -140,17 +145,71 @@ class PidROS
140145 * \param d The derivative gain.
141146 * \param i_max The max integral windup.
142147 * \param i_min The min integral windup.
148+ <<<<<<< HEAD
143149 * \param antiwindup antiwindup.
144150 * \param save_i_term save integrator output between resets.
145151 *
146152 * \note New gains are not applied if i_min_ > i_max_
147153 */
148154 [[deprecated(" Use initialize_from_args() instead" )]] void initPid (
149155 double p, double i, double d, double i_max, double i_min, bool antiwindup, bool save_i_term);
156+ =======
157+ * \param u_max Upper output clamp.
158+ * \param u_min Lower output clamp.
159+ * \param trk_tc Specifies the tracking time constant for the ' back_calculation' strategy. If set
160+ * to 0.0 when this strategy is selected, a recommended default value will be applied.
161+ * \param saturation Enables output saturation. When true , the controller output is
162+ clamped between u_max and u_min.
163+ * \param antiwindup Anti-windup functionality. When set to true , limits
164+ the integral error to prevent windup; otherwise, constrains the
165+ integral contribution to the control output. i_max and
166+ i_min are applied in both scenarios.
167+ * \param antiwindup_strat Specifies the anti-windup strategy. Options: ' back_calculation' ,
168+ ' conditional_integration' , or ' none' . Note that the ' back_calculation' strategy use the
169+ tracking_time_constant parameter to tune the anti-windup behavior. When a strategy other
170+ than ' none' is selected, it will override the controller' s default anti-windup behavior.
171+ * \d eprecated{only when `antiwindup_strat == AntiwindupStrategy::NONE`:}
172+ * Old anti-windup technique is deprecated and will be removed by
173+ * the ROS 2 Kilted Kaiju release.
174+ * \w arning{If you pass `AntiwindupStrategy::NONE`, at runtime a warning will be printed:}
175+ * `"Old anti-windup technique is deprecated. This option will be removed by the ROS 2 Kilted Kaiju release."`
176+ * \p aram save_i_term save integrator output between resets.
177+ *
178+ * \n ote New gains are not applied if i_min_ > i_max_ or if u_min_ > u_max_.
179+ */
180+ [[deprecated("Use initialize_from_args with AntiwindupStrategy only.")]]
181+ void initialize_from_args(
182+ double p, double i, double d, double i_max, double i_min, double u_max, double u_min,
183+ double trk_tc, bool saturation, bool antiwindup, AntiwindupStrategy antiwindup_strat,
184+ bool save_i_term);
185+
186+ /*!
187+ * \b rief Initialize the PID controller and set the parameters.
188+ *
189+ * \p aram p The proportional gain.
190+ * \p aram i The integral gain.
191+ * \p aram d The derivative gain.
192+ * \p aram u_max Upper output clamp.
193+ * \p aram u_min Lower output clamp.
194+ * \p aram trk_tc Specifies the tracking time constant for the ' back_calculation' strategy. If set
195+ * to 0.0 when this strategy is selected, a recommended default value will be applied.
196+ * \p aram saturation Enables output saturation. When true, the controller output is
197+ clamped between u_max and u_min.
198+ * \p aram antiwindup_strat Specifies the anti-windup strategy. Options: ' back_calculation' ,
199+ ' conditional_integration' , or ' none' . Note that the ' back_calculation' strategy use the
200+ tracking_time_constant parameter to tune the anti-windup behavior.
201+ * \p aram save_i_term save integrator output between resets.
202+ *
203+ * \n ote New gains are not applied if u_min_ > u_max_.
204+ */
205+ void initialize_from_args(
206+ double p, double i, double d, double u_max, double u_min, double trk_tc, bool saturation,
207+ AntiwindupStrategy antiwindup_strat, bool save_i_term);
208+ >>>>>>> f652c3d (Update anti-windup techniques (#298))
150209
151210 /*!
152211 * \b rief Initialize the PID controller based on already set parameters
153- * \return True if all parameters are set (p, i, d, i_min and i_max ), False otherwise
212+ * \r eturn True if all parameters are set (p, i, d, i_max, i_min, u_max, u_min and trk_tc ), False otherwise
154213 */
155214 bool initialize_from_ros_parameters();
156215
@@ -252,8 +311,67 @@ class PidROS
252311 *
253312 * \n ote New gains are not applied if i_min > i_max
254313 */
314+ [[deprecated("Use set_gains with AntiwindupStrategy instead.")]]
255315 void set_gains(double p, double i, double d, double i_max, double i_min, bool antiwindup = false);
256316
317+ /*!
318+ * \b rief Initialize the PID controller and set the parameters
319+ * \p aram p The proportional gain.
320+ * \p aram i The integral gain.
321+ * \p aram d The derivative gain.
322+ * \p aram i_max The max integral windup.
323+ * \p aram i_min The min integral windup.
324+ * \p aram u_max Upper output clamp.
325+ * \p aram u_min Lower output clamp.
326+ * \p aram trk_tc Specifies the tracking time constant for the ' back_calculation' strategy. If set
327+ * to 0.0 when this strategy is selected, a recommended default value will be applied.
328+ * \p aram saturation Enables output saturation. When true, the controller output is
329+ clamped between u_max and u_min.
330+ * \p aram antiwindup Anti-windup functionality. When set to true, limits
331+ the integral error to prevent windup; otherwise, constrains the
332+ integral contribution to the control output. i_max and
333+ i_min are applied in both scenarios.
334+ * \p aram antiwindup_strat Specifies the anti-windup strategy. Options: ' back_calculation' ,
335+ ' conditional_integration' , or ' none' . Note that the ' back_calculation' strategy use the
336+ tracking_time_constant parameter to tune the anti-windup behavior. When a strategy other
337+ than ' none' is selected, it will override the controller' s default anti-windup behavior.
338+ * \deprecated{only when `antiwindup_strat == AntiwindupStrategy::NONE`:}
339+ * Old anti-windup technique is deprecated and will be removed by
340+ * the ROS 2 Kilted Kaiju release.
341+ * \warning{If you pass `AntiwindupStrategy::NONE`, at runtime a warning will be printed:}
342+ * `" Old anti-windup technique is deprecated. This option will be removed by
343+ * the ROS 2 Kilted Kaiju release." `
344+ *
345+ * \note New gains are not applied if i_min > i_max or if u_min_ > u_max_.
346+ */
347+ [[deprecated(" Use set_gains with AntiwindupStrategy only." )]]
348+ void set_gains (
349+ double p, double i, double d, double i_max, double i_min, double u_max, double u_min,
350+ double trk_tc = 0.0 , bool saturation = false , bool antiwindup = false ,
351+ AntiwindupStrategy antiwindup_strat = AntiwindupStrategy::NONE);
352+
353+ /* !
354+ * \brief Set PID gains for the controller (preferred).
355+ *
356+ * \param p The proportional gain.
357+ * \param i The integral gain.
358+ * \param d The derivative gain.
359+ * \param u_max Upper output clamp.
360+ * \param u_min Lower output clamp.
361+ * \param trk_tc Specifies the tracking time constant for the 'back_calculation' strategy. If set
362+ * to 0.0 when this strategy is selected, a recommended default value will be applied.
363+ * \param saturation Enables output saturation. When true, the controller output is
364+ clamped between u_max and u_min.
365+ * \param antiwindup_strat Specifies the anti-windup strategy. Options: 'back_calculation',
366+ 'conditional_integration', or 'none'. Note that the 'back_calculation' strategy use the
367+ tracking_time_constant parameter to tune the anti-windup behavior.
368+ *
369+ * \note New gains are not applied if u_min_ > u_max_.
370+ */
371+ void set_gains (
372+ double p, double i, double d, double u_max, double u_min, double trk_tc, bool saturation,
373+ AntiwindupStrategy antiwindup_strat);
374+
257375 /* !
258376 * \brief Set PID gains for the controller.
259377 * \param p The proportional gain.
@@ -409,6 +527,8 @@ class PidROS
409527
410528 bool get_boolean_param (const std::string & param_name, bool & value);
411529
530+ bool get_string_param (const std::string & param_name, std::string & value);
531+
412532 /* !
413533 * \brief Set prefix for topic and parameter names
414534 * \param[in] topic_prefix prefix to add to the pid parameters.
0 commit comments