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();
41 Vector6d force_i_ = Vector6d::Zero();
42 Vector6d force_p_ = Vector6d::Zero();
43 Vector6d force_d_ = 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
void reset_all_except_depth_integral()
Resets all internal state except the depth (Z) integral term.
Definition: FeedbackController.cpp:20
bool saturated_on_depth_roll_pitch_axis_
True when the Z, Roll, or Pitch thruster axes are saturated.
Definition: FeedbackController.h:52
Vector6d get_pose_error() const
Returns the most recently computed body-frame pose error.
Definition: FeedbackController.cpp:236
Vector6d get_twist_error() const
Returns the most recently computed body-frame twist error.
Definition: FeedbackController.cpp:240
void ramp_integral(double ratio)
Interpolates the integral term between its current value and the saved snapshot.
Definition: FeedbackController.cpp:226
Vector6d get_integral_force() const
Returns the most recently computed integral force contribution.
Definition: FeedbackController.cpp:244
void reset() override
Resets all internal state including the integral term.
Definition: FeedbackController.cpp:6
void load_integral()
Restores the integral term from the most recent saved snapshot.
Definition: FeedbackController.cpp:222
Vector6d get_force(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 save_integral()
Saves a snapshot of the current integral term for later restoration.
Definition: FeedbackController.cpp:203
Vector6d get_integral_error() const
Returns the most recently computed body-frame integral error.
Definition: FeedbackController.cpp:232
bool saturated_on_yaw_xy_axis_
True when the X, Y, or Yaw thruster axes are saturated.
Definition: FeedbackController.h:49
void set_integral(const Vector6d &i)
Directly sets the integral accumulator.
Definition: FeedbackController.cpp:248
Full kinematic state of the vehicle.
Definition: Types.h:63