Skip to content

Commit 14de0ad

Browse files
committed
Add string() methods to get the printable information
1 parent 18c4b12 commit 14de0ad

File tree

1 file changed

+14
-0
lines changed
  • control_toolbox/include/control_toolbox

1 file changed

+14
-0
lines changed

control_toolbox/include/control_toolbox/pid.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ struct AntiWindupStrategy
146146
<< "\terror_deadband: " << error_deadband << std::endl;
147147
}
148148

149+
std::string string() const
150+
{
151+
return fmt::format(
152+
"antiwindup_strat: {}\ti_max: {}\ti_min: {}\ttracking_time_constant: {}\terror_deadband: {}",
153+
to_string(), i_max, i_min, tracking_time_constant, error_deadband);
154+
}
155+
149156
operator std::string() const { return to_string(); }
150157

151158
constexpr bool operator==(Value other) const { return type == other; }
@@ -326,6 +333,13 @@ class Pid
326333
antiwindup_strat_.print();
327334
}
328335

336+
std::string string() const
337+
{
338+
return fmt::format(
339+
"Gains(p: {}, i: {}, d: {}, u_max: {}, u_min: {}, antiwindup_strat: {})", p_gain_, i_gain_,
340+
d_gain_, u_max_, u_min_, antiwindup_strat_.string());
341+
}
342+
329343
double p_gain_ = 0.0; /**< Proportional gain. */
330344
double i_gain_ = 0.0; /**< Integral gain. */
331345
double d_gain_ = 0.0; /**< Derivative gain. */

0 commit comments

Comments
 (0)