controls  3.0.0
Public Member Functions | Public Attributes | List of all members
FeedbackController Class Reference

PID feedback controller with anti-windup integral clamping. More...

#include <FeedbackController.h>

Inheritance diagram for FeedbackController:
BaseControllerInterface

Public Member Functions

void reset () override
 Resets all internal state including the integral term. More...
 
void resetAllExceptDepthIntegral ()
 Resets all internal state except the depth (Z) integral term. More...
 
Vector6d getForce (const State &goal, const State &curr, double dt) override
 Computes the PID feedback force from the goal and current state. More...
 
void save_integral ()
 Saves a snapshot of the current integral term for later restoration. More...
 
void load_integral ()
 Restores the integral term from the most recent saved snapshot. More...
 
void ramp_integral (double ratio)
 Interpolates the integral term between its current value and the saved snapshot. More...
 
Vector6d getIntegralError () const
 Returns the most recently computed body-frame integral error. More...
 
Vector6d getPoseError () const
 Returns the most recently computed body-frame pose error. More...
 
Vector6d getTwistError () const
 Returns the most recently computed body-frame twist error. More...
 
Vector6d getIntegralForce () const
 Returns the most recently computed integral force contribution. More...
 
void setIntegral (const Vector6d &i)
 Directly sets the integral accumulator. More...
 
 BaseControllerInterface ()=default
 
 BaseControllerInterface (std::shared_ptr< SystemDynamicsBase > auv, std::shared_ptr< ControllerConfig > config)
 Constructs a controller with the given dynamics model and config. More...
 
- Public Member Functions inherited from BaseControllerInterface
 BaseControllerInterface ()=default
 
 BaseControllerInterface (std::shared_ptr< SystemDynamicsBase > auv, std::shared_ptr< ControllerConfig > config)
 Constructs a controller with the given dynamics model and config. More...
 
virtual ~BaseControllerInterface ()=default
 

Public Attributes

bool saturatedOnYawXYAxis = false
 True when the X, Y, or Yaw thruster axes are saturated. More...
 
bool saturatedOnDepthRollPitchAxis = false
 True when the Z, Roll, or Pitch thruster axes are saturated. More...
 

Additional Inherited Members

- Protected Attributes inherited from BaseControllerInterface
std::shared_ptr< SystemDynamicsBaseauv_
 Vehicle dynamics model shared with all controllers in a stack. More...
 
std::shared_ptr< ControllerConfigconfig_
 Tuning parameters shared with all controllers in a stack. More...
 

Detailed Description

PID feedback controller with anti-windup integral clamping.

Computes proportional, integral, and derivative forces from the body-frame pose, integral, and twist errors respectively. Separate gain sets can be activated near the water surface. The integral term is clamped when any thruster axis is saturated to prevent windup.

Member Function Documentation

◆ BaseControllerInterface() [1/2]

BaseControllerInterface::BaseControllerInterface
default

◆ BaseControllerInterface() [2/2]

BaseControllerInterface::BaseControllerInterface
inline

Constructs a controller with the given dynamics model and config.

Parameters
auv[in] Shared vehicle dynamics model
config[in] Shared controller tuning parameters

◆ getForce()

Vector6d FeedbackController::getForce ( const State goal,
const State curr,
double  dt 
)
overridevirtual

Computes the PID feedback force from the goal and current state.

Parameters
goal[in] Desired vehicle state
curr[in] Current vehicle state
dt[in] Time step in seconds used for integral accumulation
Returns
6-element PID force/torque vector in N and Nm

Implements BaseControllerInterface.

◆ getIntegralError()

Vector6d FeedbackController::getIntegralError ( ) const

Returns the most recently computed body-frame integral error.

Returns
6-element integral error vector

◆ getIntegralForce()

Vector6d FeedbackController::getIntegralForce ( ) const

Returns the most recently computed integral force contribution.

Returns
6-element integral force vector

◆ getPoseError()

Vector6d FeedbackController::getPoseError ( ) const

Returns the most recently computed body-frame pose error.

Returns
6-element pose error vector

◆ getTwistError()

Vector6d FeedbackController::getTwistError ( ) const

Returns the most recently computed body-frame twist error.

Returns
6-element twist error vector

◆ load_integral()

void FeedbackController::load_integral ( )

Restores the integral term from the most recent saved snapshot.

◆ ramp_integral()

void FeedbackController::ramp_integral ( double  ratio)

Interpolates the integral term between its current value and the saved snapshot.

Parameters
ratio[in] Blending ratio in [0, 1]; 1.0 fully loads the saved integral

◆ reset()

void FeedbackController::reset ( )
overridevirtual

Resets all internal state including the integral term.

Reimplemented from BaseControllerInterface.

◆ resetAllExceptDepthIntegral()

void FeedbackController::resetAllExceptDepthIntegral ( )

Resets all internal state except the depth (Z) integral term.

◆ save_integral()

void FeedbackController::save_integral ( )

Saves a snapshot of the current integral term for later restoration.

The snapshot is zeroed if either thruster axis group is saturated.

◆ setIntegral()

void FeedbackController::setIntegral ( const Vector6d i)

Directly sets the integral accumulator.

Parameters
i[in] New integral value

Member Data Documentation

◆ saturatedOnDepthRollPitchAxis

bool FeedbackController::saturatedOnDepthRollPitchAxis = false

True when the Z, Roll, or Pitch thruster axes are saturated.

◆ saturatedOnYawXYAxis

bool FeedbackController::saturatedOnYawXYAxis = false

True when the X, Y, or Yaw thruster axes are saturated.


The documentation for this class was generated from the following files: