@@ -139,11 +139,13 @@ struct AntiWindupStrategy
139139 }
140140 }
141141
142- void print () const
142+ void print () const { std::cout << string () << std::endl; }
143+
144+ std::string string () const
143145 {
144- std::cout << " antiwindup_strat: " << to_string () << " \t i_max: " << i_max << " , i_min: " << i_min
145- << " \t tracking_time_constant: " << tracking_time_constant
146- << " \t error_deadband: " << error_deadband << std::endl ;
146+ return fmt::format (
147+ " antiwindup_strat: {} \t i_max: {} \t i_min: {} \t tracking_time_constant: {} \t error_deadband: {} " ,
148+ to_string (), i_max, i_min, tracking_time_constant, error_deadband) ;
147149 }
148150
149151 operator std::string () const { return to_string (); }
@@ -321,11 +323,13 @@ class Pid
321323 return true ;
322324 }
323325
324- void print () const
326+ void print () const { std::cout << string () << std::endl; }
327+
328+ std::string string () const
325329 {
326- std::cout << " Gains: p: " << p_gain_ << " , i: " << i_gain_ << " , d: " << d_gain_
327- << " , u_max: " << u_max_ << " , u_min: " << u_min_ << std::endl;
328- antiwindup_strat_.print ( );
330+ return fmt::format (
331+ " Gains(p: {}, i: {}, d: {} , u_max: {}, u_min: {}, antiwindup_strat: '{}') " , p_gain_,
332+ i_gain_, d_gain_, u_max_, u_min_, antiwindup_strat_.string () );
329333 }
330334
331335 double p_gain_ = 0.0 ; /* *< Proportional gain. */
0 commit comments