CTRE Phoenix 6 C++ 25.2.1
|
Configs related to CANdi's PWM interface on the Signal 2 input (S2IN) More...
#include <ctre/phoenix6/configs/Configs.hpp>
Public Member Functions | |
constexpr | PWM2Configs ()=default |
constexpr PWM2Configs & | WithAbsoluteSensorOffset (units::angle::turn_t newAbsoluteSensorOffset) |
Modifies this configuration's AbsoluteSensorOffset parameter and returns itself for method-chaining and easier to use config API. | |
constexpr PWM2Configs & | WithAbsoluteSensorDiscontinuityPoint (units::angle::turn_t newAbsoluteSensorDiscontinuityPoint) |
Modifies this configuration's AbsoluteSensorDiscontinuityPoint parameter and returns itself for method-chaining and easier to use config API. | |
constexpr PWM2Configs & | WithSensorDirection (bool newSensorDirection) |
Modifies this configuration's SensorDirection parameter and returns itself for method-chaining and easier to use config API. | |
std::string | ToString () const override |
std::string | Serialize () const override |
ctre::phoenix::StatusCode | Deserialize (const std::string &to_deserialize) override |
Public Member Functions inherited from ctre::phoenix6::configs::ParentConfiguration | |
Public Member Functions inherited from ctre::phoenix6::ISerializable |
Public Attributes | |
units::angle::turn_t | AbsoluteSensorOffset = 0.0_tr |
The offset applied to the PWM sensor. | |
units::angle::turn_t | AbsoluteSensorDiscontinuityPoint = 0.5_tr |
The positive discontinuity point of the absolute sensor in rotations. | |
bool | SensorDirection = false |
Direction of the PWM sensor to determine positive rotation. | |
Configs related to CANdi's PWM interface on the Signal 2 input (S2IN)
All the configs related to the PWM interface for CANdi on S1, including absolute sensor offset, absolute sensor discontinuity point and sensor direction.
|
constexprdefault |
|
inlineoverridevirtual |
Implements ctre::phoenix6::configs::ParentConfiguration.
|
inlineoverridevirtual |
Implements ctre::phoenix6::ISerializable.
|
inlineoverridevirtual |
Implements ctre::phoenix6::configs::ParentConfiguration.
|
inlineconstexpr |
Modifies this configuration's AbsoluteSensorDiscontinuityPoint parameter and returns itself for method-chaining and easier to use config API.
The positive discontinuity point of the absolute sensor in rotations. This determines the point at which the absolute sensor wraps around, keeping the absolute position in the range [x-1, x).
Many rotational mechanisms such as arms have a region of motion that is unreachable. This should be set to the center of that region of motion, in non-negative rotations. This affects the position of the device at bootup.
For example, consider an arm which can travel from -0.2 to 0.6 rotations with a little leeway, where 0 is horizontally forward. Since -0.2 rotations has the same absolute position as 0.8 rotations, we can say that the arm typically does not travel in the range (0.6, 0.8) rotations. As a result, the discontinuity point would be the center of that range, which is 0.7 rotations. This results in an absolute sensor range of [-0.3, 0.7) rotations.
On a Talon motor controller, this is only supported when using the PulseWidth sensor source.
newAbsoluteSensorDiscontinuityPoint | Parameter to modify |
|
inlineconstexpr |
Modifies this configuration's AbsoluteSensorOffset parameter and returns itself for method-chaining and easier to use config API.
The offset applied to the PWM sensor.
This can be used to zero the sensor position in applications where the sensor is 1:1 with the mechanism.
newAbsoluteSensorOffset | Parameter to modify |
|
inlineconstexpr |
Modifies this configuration's SensorDirection parameter and returns itself for method-chaining and easier to use config API.
Direction of the PWM sensor to determine positive rotation. Invert this so that forward motion on the mechanism results in an increase in PWM position.
newSensorDirection | Parameter to modify |
units::angle::turn_t ctre::phoenix6::configs::PWM2Configs::AbsoluteSensorDiscontinuityPoint = 0.5_tr |
The positive discontinuity point of the absolute sensor in rotations.
This determines the point at which the absolute sensor wraps around, keeping the absolute position in the range [x-1, x).
Many rotational mechanisms such as arms have a region of motion that is unreachable. This should be set to the center of that region of motion, in non-negative rotations. This affects the position of the device at bootup.
For example, consider an arm which can travel from -0.2 to 0.6 rotations with a little leeway, where 0 is horizontally forward. Since -0.2 rotations has the same absolute position as 0.8 rotations, we can say that the arm typically does not travel in the range (0.6, 0.8) rotations. As a result, the discontinuity point would be the center of that range, which is 0.7 rotations. This results in an absolute sensor range of [-0.3, 0.7) rotations.
On a Talon motor controller, this is only supported when using the PulseWidth sensor source.
units::angle::turn_t ctre::phoenix6::configs::PWM2Configs::AbsoluteSensorOffset = 0.0_tr |
The offset applied to the PWM sensor.
This can be used to zero the sensor position in applications where the sensor is 1:1 with the mechanism.
bool ctre::phoenix6::configs::PWM2Configs::SensorDirection = false |
Direction of the PWM sensor to determine positive rotation.
Invert this so that forward motion on the mechanism results in an increase in PWM position.