CTRE Phoenix 6 C++ 26.0.0-beta-1
Loading...
Searching...
No Matches
ctre::phoenix6::configs::ClosedLoopGeneralConfigs Class Reference

Configs that affect general behavior during closed-looping. More...

#include <ctre/phoenix6/configs/ClosedLoopGeneralConfigs.hpp>

Inheritance diagram for ctre::phoenix6::configs::ClosedLoopGeneralConfigs:
ctre::phoenix6::configs::ParentConfiguration ctre::phoenix6::ISerializable

Public Member Functions

constexpr ClosedLoopGeneralConfigs ()=default
 
constexpr ClosedLoopGeneralConfigsWithContinuousWrap (bool newContinuousWrap)
 Modifies this configuration's ContinuousWrap parameter and returns itself for method-chaining and easier to use config API.
 
constexpr ClosedLoopGeneralConfigsWithDifferentialContinuousWrap (bool newDifferentialContinuousWrap)
 Modifies this configuration's DifferentialContinuousWrap parameter and returns itself for method-chaining and easier to use config API.
 
constexpr ClosedLoopGeneralConfigsWithGainSchedErrorThreshold (units::angle::turn_t newGainSchedErrorThreshold)
 Modifies this configuration's GainSchedErrorThreshold parameter and returns itself for method-chaining and easier to use config API.
 
constexpr ClosedLoopGeneralConfigsWithGainSchedKpBehavior (signals::GainSchedKpBehaviorValue newGainSchedKpBehavior)
 Modifies this configuration's GainSchedKpBehavior parameter and returns itself for method-chaining and easier to use config API.
 
std::string ToString () const override
 
std::string Serialize () const final
 
ctre::phoenix::StatusCode Deserialize (std::string const &to_deserialize) final
 
- Public Member Functions inherited from ctre::phoenix6::configs::ParentConfiguration
- Public Member Functions inherited from ctre::phoenix6::ISerializable

Public Attributes

bool ContinuousWrap = false
 Wrap position error within [-0.5, +0.5) mechanism rotations.
 
bool DifferentialContinuousWrap = false
 Wrap differential difference position error within [-0.5, +0.5) mechanism rotations.
 
units::angle::turn_t GainSchedErrorThreshold = 0.0_tr
 The position closed-loop error threshold for gain scheduling.
 
signals::GainSchedKpBehaviorValue GainSchedKpBehavior = signals::GainSchedKpBehaviorValue::Continuous
 The behavior of kP output as the error crosses the GainSchedErrorThreshold during gain scheduling.
 

Detailed Description

Configs that affect general behavior during closed-looping.

Includes Continuous Wrap features.

Constructor & Destructor Documentation

◆ ClosedLoopGeneralConfigs()

ctre::phoenix6::configs::ClosedLoopGeneralConfigs::ClosedLoopGeneralConfigs ( )
constexprdefault

Member Function Documentation

◆ Deserialize()

ctre::phoenix::StatusCode ctre::phoenix6::configs::ClosedLoopGeneralConfigs::Deserialize ( std::string const & to_deserialize)
finalvirtual

◆ Serialize()

std::string ctre::phoenix6::configs::ClosedLoopGeneralConfigs::Serialize ( ) const
finalvirtual

◆ ToString()

std::string ctre::phoenix6::configs::ClosedLoopGeneralConfigs::ToString ( ) const
overridevirtual

◆ WithContinuousWrap()

ClosedLoopGeneralConfigs & ctre::phoenix6::configs::ClosedLoopGeneralConfigs::WithContinuousWrap ( bool newContinuousWrap)
inlineconstexpr

Modifies this configuration's ContinuousWrap parameter and returns itself for method-chaining and easier to use config API.

Wrap position error within [-0.5, +0.5) mechanism rotations. Typically used for continuous position closed-loops like swerve azimuth.

This uses the mechanism rotation value. If there is a gear ratio between the sensor and the mechanism, make sure to apply a SensorToMechanismRatio so the closed loop operates on the full rotation.

  • Default Value: False
Parameters
newContinuousWrapParameter to modify
Returns
Itself

◆ WithDifferentialContinuousWrap()

ClosedLoopGeneralConfigs & ctre::phoenix6::configs::ClosedLoopGeneralConfigs::WithDifferentialContinuousWrap ( bool newDifferentialContinuousWrap)
inlineconstexpr

Modifies this configuration's DifferentialContinuousWrap parameter and returns itself for method-chaining and easier to use config API.

Wrap differential difference position error within [-0.5, +0.5) mechanism rotations. Typically used for continuous position closed-loops like a differential wrist.

This uses the differential difference rotation value. If there is a gear ratio on the difference axis, make sure to apply a SensorToDifferentialRatio so the closed loop operates on the full rotation.

  • Default Value: False
Parameters
newDifferentialContinuousWrapParameter to modify
Returns
Itself

◆ WithGainSchedErrorThreshold()

ClosedLoopGeneralConfigs & ctre::phoenix6::configs::ClosedLoopGeneralConfigs::WithGainSchedErrorThreshold ( units::angle::turn_t newGainSchedErrorThreshold)
inlineconstexpr

Modifies this configuration's GainSchedErrorThreshold parameter and returns itself for method-chaining and easier to use config API.

The position closed-loop error threshold for gain scheduling. When the absolute value of the closed-loop error is within the threshold (inclusive), the PID controller will automatically switch gains according to the configured GainSchedBehavior of the slot.

When this is zero (default), no gain scheduling will occur. Additionally, this does not take effect for velocity closed-loop controls.

This can be used to implement a closed-loop deadband or, less commonly, to switch to weaker gains when close to the target.

  • Minimum Value: 0.0
  • Maximum Value: 1.0
  • Default Value: 0.0
  • Units: rotations
Parameters
newGainSchedErrorThresholdParameter to modify
Returns
Itself

◆ WithGainSchedKpBehavior()

ClosedLoopGeneralConfigs & ctre::phoenix6::configs::ClosedLoopGeneralConfigs::WithGainSchedKpBehavior ( signals::GainSchedKpBehaviorValue newGainSchedKpBehavior)
inlineconstexpr

Modifies this configuration's GainSchedKpBehavior parameter and returns itself for method-chaining and easier to use config API.

The behavior of kP output as the error crosses the GainSchedErrorThreshold during gain scheduling. The output of kP can be adjusted to maintain continuity in output, or it can be left discontinuous.

Parameters
newGainSchedKpBehaviorParameter to modify
Returns
Itself

Member Data Documentation

◆ ContinuousWrap

bool ctre::phoenix6::configs::ClosedLoopGeneralConfigs::ContinuousWrap = false

Wrap position error within [-0.5, +0.5) mechanism rotations.

Typically used for continuous position closed-loops like swerve azimuth.

This uses the mechanism rotation value. If there is a gear ratio between the sensor and the mechanism, make sure to apply a SensorToMechanismRatio so the closed loop operates on the full rotation.

  • Default Value: False

◆ DifferentialContinuousWrap

bool ctre::phoenix6::configs::ClosedLoopGeneralConfigs::DifferentialContinuousWrap = false

Wrap differential difference position error within [-0.5, +0.5) mechanism rotations.

Typically used for continuous position closed-loops like a differential wrist.

This uses the differential difference rotation value. If there is a gear ratio on the difference axis, make sure to apply a SensorToDifferentialRatio so the closed loop operates on the full rotation.

  • Default Value: False

◆ GainSchedErrorThreshold

units::angle::turn_t ctre::phoenix6::configs::ClosedLoopGeneralConfigs::GainSchedErrorThreshold = 0.0_tr

The position closed-loop error threshold for gain scheduling.

When the absolute value of the closed-loop error is within the threshold (inclusive), the PID controller will automatically switch gains according to the configured GainSchedBehavior of the slot.

When this is zero (default), no gain scheduling will occur. Additionally, this does not take effect for velocity closed-loop controls.

This can be used to implement a closed-loop deadband or, less commonly, to switch to weaker gains when close to the target.

  • Minimum Value: 0.0
  • Maximum Value: 1.0
  • Default Value: 0.0
  • Units: rotations

◆ GainSchedKpBehavior

signals::GainSchedKpBehaviorValue ctre::phoenix6::configs::ClosedLoopGeneralConfigs::GainSchedKpBehavior = signals::GainSchedKpBehaviorValue::Continuous

The behavior of kP output as the error crosses the GainSchedErrorThreshold during gain scheduling.

The output of kP can be adjusted to maintain continuity in output, or it can be left discontinuous.


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