libstp
Robotics library for Botball
Loading...
Searching...
No Matches
velocity_tune.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <map>
4#include <optional>
5#include <string>
6#include <vector>
7
8#include "autotune/types.hpp"
9#include "drive/drive.hpp"
10#include "hal/odometry.hpp"
11
12namespace libstp::autotune
13{
31 {
32 public:
38
50 const std::string& axis,
51 double max_velocity,
52 const VelocityTuneConfig& cfg) const;
53
64 [[nodiscard]] std::map<std::string, VelocityTuneResult> tune(
65 const std::vector<std::string>& axes,
66 const std::map<std::string, double>& max_velocities,
67 const VelocityTuneConfig& cfg) const;
68
69 private:
76 [[nodiscard]] StepResponseData runStepResponse(
77 const std::string& axis,
78 double command,
79 double duration_s,
80 int sample_hz) const;
81
88 [[nodiscard]] std::optional<PlantParams> identifyPlantInflection(
89 const StepResponseData& data,
90 double command) const;
91
98 [[nodiscard]] PlantParams identifyPlantRiseTime(
99 const StepResponseData& data,
100 double command) const;
101
107 [[nodiscard]] foundation::PidGains computeChrGains(
108 const PlantParams& plant,
109 const VelocityTuneConfig& cfg) const;
110
114 [[nodiscard]] static double computeIse(const StepResponseData& data);
115
119 [[nodiscard]] static double tailMeanAbs(const StepResponseData& data);
120
124 [[nodiscard]] static double peakAbs(const StepResponseData& data);
125
126 drive::Drive& drive_;
127 odometry::IOdometry& odometry_;
128 };
129
130} // namespace libstp::autotune
VelocityTuner(drive::Drive &drive, odometry::IOdometry &odometry)
std::map< std::string, VelocityTuneResult > tune(const std::vector< std::string > &axes, const std::map< std::string, double > &max_velocities, const VelocityTuneConfig &cfg) const
Tune multiple axes in sequence.
VelocityTuneResult tuneAxis(const std::string &axis, double max_velocity, const VelocityTuneConfig &cfg) const
Tune a single velocity axis.
First-order-plus-dead-time (FOPDT) plant parameters extracted from a step-response recording.
Definition types.hpp:67
Raw step-response recording for one velocity axis.
Definition types.hpp:56
Configuration for the VelocityTuner.
Definition types.hpp:106
Result of tuning a single velocity axis.
Definition types.hpp:79
Basic PID gains without integrator and output shaping parameters.
Definition motor.hpp:18