8#include <condition_variable>
59 [[nodiscard]] std::map<std::string, MotionTuneResult>
tune(
60 const std::vector<std::string>& params,
71 const std::string& param_name,
90 [[nodiscard]] std::tuple<
double,
double,
double> runLinearTrial(
102 [[nodiscard]] std::tuple<
double,
double,
double> runTurnTrial(
117 void returnLinear(
motion::LinearAxis axis,
double home_heading_rad,
126 void returnTurn(
double home_heading_rad, const
MotionTuneConfig& cfg) const;
132 [[nodiscard]]
double evaluateGains(
133 const std::
string& param_name,
145 [[nodiscard]]
double scoreMotionTrial(
146 const std::
string& param_name,
156 [[nodiscard]]
double linearTargetDistance(
163 [[nodiscard]]
double trialTimeoutS(
170 void pauseIfRequested() const;
172 drive::Drive& drive_;
174 motion::UnifiedMotionPidConfig& pid_config_;
175 mutable std::atomic<
bool> pause_requested_{
false};
176 mutable std::atomic<bool> paused_{
false};
177 mutable std::mutex pause_mutex_;
178 mutable std::condition_variable pause_cv_;
void requestPauseAfterTrial() const noexcept
Queue a pause that takes effect after the current trial completes.
MotionTuner(drive::Drive &drive, odometry::IOdometry &odometry, motion::UnifiedMotionPidConfig &pid_config)
void resume() const noexcept
Cancel a queued pause or resume from an active pause.
std::map< std::string, MotionTuneResult > tune(const std::vector< std::string > ¶ms, const MotionTuneConfig &cfg) const
Tune multiple parameters in sequence.
std::string pauseState() const
Current operator-control state: "running", "stop_queued", or "stopped".
MotionTuneResult tuneParam(const std::string ¶m_name, const MotionTuneConfig &cfg) const
Tune a single motion PID parameter.
Configuration for the MotionTuner (Hooke-Jeeves coordinate descent).
Result of tuning a single motion PID parameter (distance, lateral, or heading).