Package com.ctre.phoenix6.configs
Class MagnetSensorConfigs
java.lang.Object
com.ctre.phoenix6.configs.MagnetSensorConfigs
- All Implemented Interfaces:
ParentConfiguration
,ISerializable
public class MagnetSensorConfigs extends Object implements ParentConfiguration
Configs that affect the magnet sensor and how to interpret it.
Includes sensor range, sensor direction, and the magnet offset.
-
Field Summary
Fields Modifier and Type Field Description AbsoluteSensorRangeValue
AbsoluteSensorRange
The range of the absolute sensor in rotations, either [-0.5, 0.5) or [0, 1).double
MagnetOffset
This offset is added to the reported position, allowing the application to trim the zero position.SensorDirectionValue
SensorDirection
Direction of the sensor to determine positive rotation, as seen facing the LED side of the CANcoder. -
Constructor Summary
Constructors Constructor Description MagnetSensorConfigs()
-
Method Summary
Modifier and Type Method Description StatusCode
deserialize(String to_deserialize)
String
serialize()
String
toString()
MagnetSensorConfigs
withAbsoluteSensorRange(AbsoluteSensorRangeValue newAbsoluteSensorRange)
Modifies this configuration's AbsoluteSensorRange parameter and returns itself for method-chaining and easier to use config API.MagnetSensorConfigs
withMagnetOffset(double newMagnetOffset)
Modifies this configuration's MagnetOffset parameter and returns itself for method-chaining and easier to use config API.MagnetSensorConfigs
withSensorDirection(SensorDirectionValue newSensorDirection)
Modifies this configuration's SensorDirection parameter and returns itself for method-chaining and easier to use config API.
-
Field Details
-
SensorDirection
Direction of the sensor to determine positive rotation, as seen facing the LED side of the CANcoder. -
MagnetOffset
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
-
AbsoluteSensorRange
The range of the absolute sensor in rotations, either [-0.5, 0.5) or [0, 1).
-
-
Constructor Details
-
MagnetSensorConfigs
public MagnetSensorConfigs()
-
-
Method Details
-
withSensorDirection
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:
newSensorDirection
- Parameter to modify- Returns:
- Itself
-
withMagnetOffset
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:
newMagnetOffset
- Parameter to modify- Returns:
- Itself
-
withAbsoluteSensorRange
public MagnetSensorConfigs withAbsoluteSensorRange(AbsoluteSensorRangeValue newAbsoluteSensorRange)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:
newAbsoluteSensorRange
- Parameter to modify- Returns:
- Itself
-
toString
-
deserialize
- Specified by:
deserialize
in interfaceParentConfiguration
-
serialize
- Specified by:
serialize
in interfaceISerializable
-