Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions control_toolbox/include/control_toolbox/pid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,13 @@ struct AntiWindupStrategy
}
}

void print() const
void print() const { std::cout << string() << std::endl; }

std::string string() const
{
std::cout << "antiwindup_strat: " << to_string() << "\ti_max: " << i_max << ", i_min: " << i_min
<< "\ttracking_time_constant: " << tracking_time_constant
<< "\terror_deadband: " << error_deadband << std::endl;
return fmt::format(
"antiwindup_strat: {}\ti_max: {}\ti_min: {}\ttracking_time_constant: {}\terror_deadband: {}",
to_string(), i_max, i_min, tracking_time_constant, error_deadband);
}

operator std::string() const { return to_string(); }
Expand Down Expand Up @@ -319,11 +321,13 @@ class Pid
return true;
}

void print() const
void print() const { std::cout << string() << std::endl; }

std::string string() const
{
std::cout << "Gains: p: " << p_gain_ << ", i: " << i_gain_ << ", d: " << d_gain_
<< ", u_max: " << u_max_ << ", u_min: " << u_min_ << std::endl;
antiwindup_strat_.print();
return fmt::format(
"Gains(p: {}, i: {}, d: {}, u_max: {}, u_min: {}, antiwindup_strat: '{}')", p_gain_,
i_gain_, d_gain_, u_max_, u_min_, antiwindup_strat_.string());
}

double p_gain_ = 0.0; /**< Proportional gain. */
Expand Down