Class PWM2Configs
- All Implemented Interfaces:
ParentConfiguration
,ISerializable
All the configs related to the PWM interface for CANdi on S1, including absolute sensor offset, absolute sensor discontinuity point and sensor direction.
-
Field Summary
Modifier and TypeFieldDescriptiondouble
The positive discontinuity point of the absolute sensor in rotations.double
The offset applied to the PWM sensor.boolean
Direction of the PWM sensor to determine positive rotation. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondeserialize
(String to_deserialize) Helper method to get this configuration's AbsoluteSensorDiscontinuityPoint parameter converted to a unit type.Helper method to get this configuration's AbsoluteSensorOffset parameter converted to a unit type.toString()
withAbsoluteSensorDiscontinuityPoint
(double newAbsoluteSensorDiscontinuityPoint) Modifies this configuration's AbsoluteSensorDiscontinuityPoint parameter and returns itself for method-chaining and easier to use config API.withAbsoluteSensorDiscontinuityPoint
(Angle newAbsoluteSensorDiscontinuityPoint) Modifies this configuration's AbsoluteSensorDiscontinuityPoint parameter and returns itself for method-chaining and easier to use config API.withAbsoluteSensorOffset
(double newAbsoluteSensorOffset) Modifies this configuration's AbsoluteSensorOffset parameter and returns itself for method-chaining and easier to use config API.withAbsoluteSensorOffset
(Angle newAbsoluteSensorOffset) Modifies this configuration's AbsoluteSensorOffset parameter and returns itself for method-chaining and easier to use config API.withSensorDirection
(boolean newSensorDirection) Modifies this configuration's SensorDirection parameter and returns itself for method-chaining and easier to use config API.
-
Field Details
-
AbsoluteSensorOffset
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.
- Minimum Value: -1
- Maximum Value: 1
- Default Value: 0.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 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.
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
-
SensorDirection
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.- Default Value: False
-
-
Constructor Details
-
PWM2Configs
public PWM2Configs()
-
-
Method Details
-
withAbsoluteSensorOffset
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.
- Minimum Value: -1
- Maximum Value: 1
- Default Value: 0.0
- Units: rotations
- Parameters:
newAbsoluteSensorOffset
- Parameter to modify- Returns:
- Itself
-
withAbsoluteSensorOffset
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.
- Minimum Value: -1
- Maximum Value: 1
- Default Value: 0.0
- Units: rotations
- Parameters:
newAbsoluteSensorOffset
- Parameter to modify- Returns:
- Itself
-
getAbsoluteSensorOffsetMeasure
Helper method to get this configuration's AbsoluteSensorOffset parameter converted to a unit type. If not using the Java units library,AbsoluteSensorOffset
can be accessed directly instead.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.
- Minimum Value: -1
- Maximum Value: 1
- Default Value: 0.0
- Units: rotations
- Returns:
- AbsoluteSensorOffset
-
withAbsoluteSensorDiscontinuityPoint
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).
- 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.
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
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).
- 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.
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,AbsoluteSensorDiscontinuityPoint
can 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 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.
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
-
withSensorDirection
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.
- Default Value: False
- Parameters:
newSensorDirection
- Parameter to modify- Returns:
- Itself
-
toString
-
deserialize
- Specified by:
deserialize
in interfaceParentConfiguration
-
serialize
- Specified by:
serialize
in interfaceISerializable
-