@@ -135,11 +135,13 @@ struct AntiWindupStrategy
135135 }
136136 }
137137
138- void print () const
138+ void print () const { std::cout << string () << std::endl; }
139+
140+ std::string string () const
139141 {
140- std::cout << " antiwindup_strat: " << to_string () << " \t i_max: " << i_max << " , i_min: " << i_min
141- << " \t tracking_time_constant: " << tracking_time_constant
142- << " \t error_deadband: " << error_deadband << std::endl ;
142+ return fmt::format (
143+ " antiwindup_strat: {} \t i_max: {} \t i_min: {} \t tracking_time_constant: {} \t error_deadband: {} " ,
144+ to_string (), i_max, i_min, tracking_time_constant, error_deadband) ;
143145 }
144146
145147 operator std::string () const { return to_string (); }
@@ -315,11 +317,13 @@ class Pid
315317 return true ;
316318 }
317319
318- void print () const
320+ void print () const { std::cout << string () << std::endl; }
321+
322+ std::string string () const
319323 {
320- std::cout << " Gains: p: " << p_gain_ << " , i: " << i_gain_ << " , d: " << d_gain_
321- << " , u_max: " << u_max_ << " , u_min: " << u_min_ << std::endl;
322- antiwindup_strat_.print ( );
324+ return fmt::format (
325+ " Gains(p: {}, i: {}, d: {} , u_max: {}, u_min: {}, antiwindup_strat: '{}') " , p_gain_,
326+ i_gain_, d_gain_, u_max_, u_min_, antiwindup_strat_.string () );
323327 }
324328
325329 double p_gain_ = 0.0 ; /* *< Proportional gain. */
0 commit comments