Class MagnetSensorConfigs
- All Implemented Interfaces:
ParentConfiguration,ISerializable,Cloneable
Includes sensor direction, the sensor discontinuity point, and the magnet offset.
-
Field Summary
FieldsModifier and TypeFieldDescriptiondoubleThe positive discontinuity point of the absolute sensor in rotations.doubleThis offset is added to the reported position, allowing the application to trim the zero position.Direction of the sensor to determine positive rotation, as seen facing the LED side of the CANcoder. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()final StatusCodedeserialize(String to_deserialize) Take a string and deserialize it to this configuration group.final AngleHelper method to get this configuration's AbsoluteSensorDiscontinuityPoint parameter converted to a unit type.final AngleHelper method to get this configuration's MagnetOffset parameter converted to a unit type.final StringGet the serialized form of this configuration group.toString()final MagnetSensorConfigswithAbsoluteSensorDiscontinuityPoint(double newAbsoluteSensorDiscontinuityPoint) Modifies this configuration's AbsoluteSensorDiscontinuityPoint parameter and returns itself for method-chaining and easier to use config API.final MagnetSensorConfigswithAbsoluteSensorDiscontinuityPoint(Angle newAbsoluteSensorDiscontinuityPoint) Modifies this configuration's AbsoluteSensorDiscontinuityPoint parameter and returns itself for method-chaining and easier to use config API.final MagnetSensorConfigswithMagnetOffset(double newMagnetOffset) Modifies this configuration's MagnetOffset parameter and returns itself for method-chaining and easier to use config API.final MagnetSensorConfigswithMagnetOffset(Angle newMagnetOffset) Modifies this configuration's MagnetOffset parameter and returns itself for method-chaining and easier to use config API.final MagnetSensorConfigswithSensorDirection(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
-
AbsoluteSensorDiscontinuityPoint
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 (after offset) in the range [x-1, x).- Setting this to 1 makes the absolute position unsigned [0, 1)
- Setting this to 0.5 makes the absolute position signed [-0.5, 0.5)
- Setting this to 0 makes the absolute position always negative [-1, 0)
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.
Given a total range of motion less than 1 rotation, users can calculate the discontinuity point using mean(lowerLimit, upperLimit) + 0.5. If that results in a value outside the range [0, 1], either cap the value to [0, 1], or add/subtract 1.0 rotation from your lower and upper limits of motion.
On a Talon motor controller, this is only supported when using the PulseWidth sensor source.
- Minimum Value: 0.0
- Maximum Value: 1.0
- Default Value: 0.5
- Units: rotations
-
-
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
-
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
-
getMagnetOffsetMeasure
Helper method to get this configuration's MagnetOffset parameter converted to a unit type. If not using the Java units library,MagnetOffsetcan be accessed directly instead.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
- Returns:
- MagnetOffset
-
withAbsoluteSensorDiscontinuityPoint
public final MagnetSensorConfigs withAbsoluteSensorDiscontinuityPoint(double newAbsoluteSensorDiscontinuityPoint) 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 (after offset) in the range [x-1, x).
- Setting this to 1 makes the absolute position unsigned [0, 1)
- Setting this to 0.5 makes the absolute position signed [-0.5, 0.5)
- Setting this to 0 makes the absolute position always negative [-1, 0)
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.
Given a total range of motion less than 1 rotation, users can calculate the discontinuity point using mean(lowerLimit, upperLimit) + 0.5. If that results in a value outside the range [0, 1], either cap the value to [0, 1], or add/subtract 1.0 rotation from your lower and upper limits of motion.
On a Talon motor controller, this is only supported when using the PulseWidth sensor source.
- Minimum Value: 0.0
- Maximum Value: 1.0
- Default Value: 0.5
- Units: rotations
- Parameters:
newAbsoluteSensorDiscontinuityPoint- Parameter to modify- Returns:
- Itself
-
withAbsoluteSensorDiscontinuityPoint
public final MagnetSensorConfigs withAbsoluteSensorDiscontinuityPoint(Angle newAbsoluteSensorDiscontinuityPoint) 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 (after offset) in the range [x-1, x).
- Setting this to 1 makes the absolute position unsigned [0, 1)
- Setting this to 0.5 makes the absolute position signed [-0.5, 0.5)
- Setting this to 0 makes the absolute position always negative [-1, 0)
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.
Given a total range of motion less than 1 rotation, users can calculate the discontinuity point using mean(lowerLimit, upperLimit) + 0.5. If that results in a value outside the range [0, 1], either cap the value to [0, 1], or add/subtract 1.0 rotation from your lower and upper limits of motion.
On a Talon motor controller, this is only supported when using the PulseWidth sensor source.
- Minimum Value: 0.0
- Maximum Value: 1.0
- Default Value: 0.5
- Units: rotations
- Parameters:
newAbsoluteSensorDiscontinuityPoint- Parameter to modify- Returns:
- Itself
-
getAbsoluteSensorDiscontinuityPointMeasure
Helper method to get this configuration's AbsoluteSensorDiscontinuityPoint parameter converted to a unit type. If not using the Java units library,AbsoluteSensorDiscontinuityPointcan be accessed directly instead.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 (after offset) in the range [x-1, x).
- Setting this to 1 makes the absolute position unsigned [0, 1)
- Setting this to 0.5 makes the absolute position signed [-0.5, 0.5)
- Setting this to 0 makes the absolute position always negative [-1, 0)
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.
Given a total range of motion less than 1 rotation, users can calculate the discontinuity point using mean(lowerLimit, upperLimit) + 0.5. If that results in a value outside the range [0, 1], either cap the value to [0, 1], or add/subtract 1.0 rotation from your lower and upper limits of motion.
On a Talon motor controller, this is only supported when using the PulseWidth sensor source.
- Minimum Value: 0.0
- Maximum Value: 1.0
- Default Value: 0.5
- Units: rotations
- Returns:
- AbsoluteSensorDiscontinuityPoint
-
toString
-
serialize
Get the serialized form of this configuration group.- Specified by:
serializein interfaceISerializable- Returns:
- Serialized form of this config group
-
deserialize
Take a string and deserialize it to this configuration group.- Specified by:
deserializein interfaceParentConfiguration- Returns:
- Return code of the deserialize method
-
clone
-