CTRE Phoenix 6 C++ 24.50.0-alpha-2
ctre::phoenix6::configs::MagnetSensorConfigs Class Reference

Configs that affect the magnet sensor and how to interpret it. More...

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

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

Public Member Functions

constexpr MagnetSensorConfigs ()=default
 
constexpr MagnetSensorConfigsWithSensorDirection (signals::SensorDirectionValue newSensorDirection)
 Modifies this configuration's SensorDirection parameter and returns itself for method-chaining and easier to use config API. More...
 
constexpr MagnetSensorConfigsWithMagnetOffset (units::angle::turn_t newMagnetOffset)
 Modifies this configuration's MagnetOffset parameter and returns itself for method-chaining and easier to use config API. More...
 
constexpr MagnetSensorConfigsWithAbsoluteSensorRange (signals::AbsoluteSensorRangeValue newAbsoluteSensorRange)
 Modifies this configuration's AbsoluteSensorRange parameter and returns itself for method-chaining and easier to use config API. More...
 
std::string ToString () const override
 
std::string Serialize () const override
 
ctre::phoenix::StatusCode Deserialize (const std::string &to_deserialize) override
 
virtual std::string ToString () const =0
 
virtual ctre::phoenix::StatusCode Deserialize (const std::string &string)=0
 
virtual std::string Serialize () const =0
 

Public Attributes

signals::SensorDirectionValue SensorDirection = signals::SensorDirectionValue::CounterClockwise_Positive
 Direction of the sensor to determine positive rotation, as seen facing the LED side of the CANcoder. More...
 
units::angle::turn_t MagnetOffset = 0_tr
 This offset is added to the reported position, allowing the application to trim the zero position. More...
 
signals::AbsoluteSensorRangeValue AbsoluteSensorRange = signals::AbsoluteSensorRangeValue::Signed_PlusMinusHalf
 The range of the absolute sensor in rotations, either [-0.5, 0.5) or [0, 1). More...
 

Detailed Description

Configs that affect the magnet sensor and how to interpret it.

Includes sensor range, sensor direction, and the magnet offset.

Constructor & Destructor Documentation

◆ MagnetSensorConfigs()

constexpr ctre::phoenix6::configs::MagnetSensorConfigs::MagnetSensorConfigs ( )
constexprdefault

Member Function Documentation

◆ Deserialize()

ctre::phoenix::StatusCode ctre::phoenix6::configs::MagnetSensorConfigs::Deserialize ( const std::string &  to_deserialize)
inlineoverridevirtual

◆ Serialize()

std::string ctre::phoenix6::configs::MagnetSensorConfigs::Serialize ( ) const
inlineoverridevirtual

◆ ToString()

std::string ctre::phoenix6::configs::MagnetSensorConfigs::ToString ( ) const
inlineoverridevirtual

◆ WithAbsoluteSensorRange()

constexpr MagnetSensorConfigs & ctre::phoenix6::configs::MagnetSensorConfigs::WithAbsoluteSensorRange ( signals::AbsoluteSensorRangeValue  newAbsoluteSensorRange)
inlineconstexpr

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

The range of the absolute sensor in rotations, either [-0.5, 0.5) or [0, 1).

Parameters
newAbsoluteSensorRangeParameter to modify
Returns
Itself

◆ WithMagnetOffset()

constexpr MagnetSensorConfigs & ctre::phoenix6::configs::MagnetSensorConfigs::WithMagnetOffset ( units::angle::turn_t  newMagnetOffset)
inlineconstexpr

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

This offset is added to the reported position, allowing the application to trim the zero position. When set to the default value of zero, position reports zero when magnet north pole aligns with the LED.

  • Minimum Value: -1
  • Maximum Value: 1
  • Default Value: 0
  • Units: rotations
Parameters
newMagnetOffsetParameter to modify
Returns
Itself

◆ WithSensorDirection()

constexpr MagnetSensorConfigs & ctre::phoenix6::configs::MagnetSensorConfigs::WithSensorDirection ( signals::SensorDirectionValue  newSensorDirection)
inlineconstexpr

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

Direction of the sensor to determine positive rotation, as seen facing the LED side of the CANcoder.

Parameters
newSensorDirectionParameter to modify
Returns
Itself

Member Data Documentation

◆ AbsoluteSensorRange

signals::AbsoluteSensorRangeValue ctre::phoenix6::configs::MagnetSensorConfigs::AbsoluteSensorRange = signals::AbsoluteSensorRangeValue::Signed_PlusMinusHalf

The range of the absolute sensor in rotations, either [-0.5, 0.5) or [0, 1).

◆ MagnetOffset

units::angle::turn_t ctre::phoenix6::configs::MagnetSensorConfigs::MagnetOffset = 0_tr

This offset is added to the reported position, allowing the application to trim the zero position.

When set to the default value of zero, position reports zero when magnet north pole aligns with the LED.

  • Minimum Value: -1
  • Maximum Value: 1
  • Default Value: 0
  • Units: rotations

◆ SensorDirection

signals::SensorDirectionValue ctre::phoenix6::configs::MagnetSensorConfigs::SensorDirection = signals::SensorDirectionValue::CounterClockwise_Positive

Direction of the sensor to determine positive rotation, as seen facing the LED side of the CANcoder.


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