WOrking with ramp ref
This commit is contained in:
@@ -25,6 +25,11 @@
|
||||
#define HEAVE_FF_GAP_MAX 20.0f
|
||||
#define HEAVE_FF_GAP_STEP 0.269841f
|
||||
|
||||
// ── Reference Ramp ───────────────────────────────────────────
|
||||
// Per-update step the active ref moves toward the target. At 200Hz tick
|
||||
// rate, 0.001f mm/tick = 0.2 mm/s. Override via constructor.
|
||||
#define HEAVE_DEFAULT_RAMP_STEP 0.001f
|
||||
|
||||
// ── PID Gains / State ────────────────────────────────────────
|
||||
typedef struct HeavePIDGains {
|
||||
float kp;
|
||||
@@ -48,7 +53,8 @@ public:
|
||||
|
||||
HeaveController(IndSensorL& f, IndSensorL& b,
|
||||
HeavePIDGains gains, float avgRef,
|
||||
bool useFeedforward = true);
|
||||
float rampStep = HEAVE_DEFAULT_RAMP_STEP,
|
||||
bool useFeedforward = false);
|
||||
|
||||
void update();
|
||||
void zeroPWMs();
|
||||
@@ -75,13 +81,16 @@ private:
|
||||
HeavePIDGains gains;
|
||||
HeavePIDState state;
|
||||
|
||||
float AvgRef;
|
||||
float AvgRef; // active ref the PID tracks; ramps toward targetRef
|
||||
float targetRef; // final desired ref (set by updateReference)
|
||||
float rampStep; // per-update step size for AvgRef → targetRef
|
||||
float avg;
|
||||
|
||||
int16_t PWM;
|
||||
int16_t ffPWM; // last feedforward value (for debugging/reporting)
|
||||
bool fullAttract;
|
||||
bool ffEnabled;
|
||||
bool prevPidActive; // transition detector for seeding AvgRef = avg
|
||||
};
|
||||
|
||||
#endif // HEAVE_CONTROLLER_HPP
|
||||
|
||||
Reference in New Issue
Block a user