Skip to content

Commit cae03d8

Browse files
committed
reuse information in print
1 parent 14de0ad commit cae03d8

File tree

1 file changed

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

1 file changed

+4
-14
lines changed

control_toolbox/include/control_toolbox/pid.hpp

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,7 @@ struct AntiWindupStrategy
139139
}
140140
}
141141

142-
void print() const
143-
{
144-
std::cout << "antiwindup_strat: " << to_string() << "\ti_max: " << i_max << ", i_min: " << i_min
145-
<< "\ttracking_time_constant: " << tracking_time_constant
146-
<< "\terror_deadband: " << error_deadband << std::endl;
147-
}
142+
void print() const { std::cout << string() << std::endl; }
148143

149144
std::string string() const
150145
{
@@ -326,18 +321,13 @@ class Pid
326321
return true;
327322
}
328323

329-
void print() const
330-
{
331-
std::cout << "Gains: p: " << p_gain_ << ", i: " << i_gain_ << ", d: " << d_gain_
332-
<< ", u_max: " << u_max_ << ", u_min: " << u_min_ << std::endl;
333-
antiwindup_strat_.print();
334-
}
324+
void print() const { std::cout << string() << std::endl; }
335325

336326
std::string string() const
337327
{
338328
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());
329+
"Gains(p: {}, i: {}, d: {}, u_max: {}, u_min: {}, antiwindup_strat: '{}')", p_gain_,
330+
i_gain_, d_gain_, u_max_, u_min_, antiwindup_strat_.string());
341331
}
342332

343333
double p_gain_ = 0.0; /**< Proportional gain. */

0 commit comments

Comments
 (0)