CTRE Phoenix 6 C++ 24.3.0
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

MagnetSensorConfigsWithSensorDirection (signals::SensorDirectionValue newSensorDirection)
 Modifies this configuration's SensorDirection parameter and returns itself for method-chaining and easier to use config API. More...
 
MagnetSensorConfigsWithMagnetOffset (double newMagnetOffset)
 Modifies this configuration's MagnetOffset parameter and returns itself for method-chaining and easier to use config API. More...
 
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...
 
double MagnetOffset = 0
 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.

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()

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

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()

MagnetSensorConfigs & ctre::phoenix6::configs::MagnetSensorConfigs::WithMagnetOffset ( double  newMagnetOffset)
inline

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()

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

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

double ctre::phoenix6::configs::MagnetSensorConfigs::MagnetOffset = 0

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: