1 #ifndef CONTROLS_CONTROLLER_FEEDBACK_CONTROLLER_H
2 #define CONTROLS_CONTROLLER_FEEDBACK_CONTROLLER_H
15 static constexpr
double MAX_DT = 0.1;
16 static constexpr
double EXPLODE_THRESHOLD = 1e4;
17 static constexpr
double INTEGRAL_CLAMP = 5.0;
18 static constexpr
double INTEGRAL_DECAY_FACTOR = 0.5;
21 double error_saturation_limit = 1;
26 Vector6d body_integral_error = Vector6d::Zero();
27 Vector6d body_pose_error = Vector6d::Zero();
28 Vector6d body_twist_error = Vector6d::Zero();
31 Vector6d integral = Vector6d::Zero();
39 Vector6d saved_integral = Vector6d::Zero();
57 void reset()
override;
Eigen::Matrix< double, 6, 1 > Vector6d
Definition: Types.h:29
Eigen::Matrix< double, 18, 1 > Vector18d
Definition: Types.h:30
Abstract base class for a single-responsibility force controller.
Definition: BaseControllerInterface.h:15
BaseControllerInterface()=default
PID feedback controller with anti-windup integral clamping.
Definition: FeedbackController.h:14
Vector6d getIntegralForce() const
Returns the most recently computed integral force contribution.
Definition: FeedbackController.cpp:244
Vector6d getPoseError() const
Returns the most recently computed body-frame pose error.
Definition: FeedbackController.cpp:236
void ramp_integral(double ratio)
Interpolates the integral term between its current value and the saved snapshot.
Definition: FeedbackController.cpp:226
bool saturatedOnDepthRollPitchAxis
True when the Z, Roll, or Pitch thruster axes are saturated.
Definition: FeedbackController.h:52
void setIntegral(const Vector6d &i)
Directly sets the integral accumulator.
Definition: FeedbackController.cpp:248
void reset() override
Resets all internal state including the integral term.
Definition: FeedbackController.cpp:6
Vector6d getIntegralError() const
Returns the most recently computed body-frame integral error.
Definition: FeedbackController.cpp:232
void load_integral()
Restores the integral term from the most recent saved snapshot.
Definition: FeedbackController.cpp:222
void save_integral()
Saves a snapshot of the current integral term for later restoration.
Definition: FeedbackController.cpp:203
Vector6d getTwistError() const
Returns the most recently computed body-frame twist error.
Definition: FeedbackController.cpp:240
Vector6d getForce(const State &goal, const State &curr, double dt) override
Computes the PID feedback force from the goal and current state.
Definition: FeedbackController.cpp:26
void resetAllExceptDepthIntegral()
Resets all internal state except the depth (Z) integral term.
Definition: FeedbackController.cpp:20
bool saturatedOnYawXYAxis
True when the X, Y, or Yaw thruster axes are saturated.
Definition: FeedbackController.h:49
Full kinematic state of the vehicle.
Definition: Types.h:63