Package frc.team88.swerve.module.sensor
Class SensorTransmission
- java.lang.Object
-
- frc.team88.swerve.module.sensor.SensorTransmission
-
- All Implemented Interfaces:
PositionSensor
public class SensorTransmission extends java.lang.Object implements PositionSensor
Composed of a single sensor, and applies a gear ratio to it.
-
-
Constructor Summary
Constructors Constructor Description SensorTransmission(PositionSensor inputSensor, SensorTransmissionConfiguration config)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
applyTransmissionForwards(double value)
Applies the gear ratio, inversion, and offset to get from an input value to an output value.protected double
applyTransmissionReverse(double value)
Applies the gear ratio, inversion, and offset to get from an output value to an input value.protected double
getInversionConstant()
Returns -1.double
getPosition()
Get the position value of the sensor.
-
-
-
Constructor Detail
-
SensorTransmission
public SensorTransmission(PositionSensor inputSensor, SensorTransmissionConfiguration config)
Constructor.- Parameters:
inputSensor
- The sensor on the input of the transmission.config
- The config data for this sensor transmission.
-
-
Method Detail
-
getPosition
public double getPosition()
Description copied from interface:PositionSensor
Get the position value of the sensor.- Specified by:
getPosition
in interfacePositionSensor
- Returns:
- The position value in rotations.
-
applyTransmissionForwards
protected double applyTransmissionForwards(double value)
Applies the gear ratio, inversion, and offset to get from an input value to an output value.- Parameters:
value
- The input value.- Returns:
- The output value.
-
applyTransmissionReverse
protected double applyTransmissionReverse(double value)
Applies the gear ratio, inversion, and offset to get from an output value to an input value.- Parameters:
value
- The output value.- Returns:
- The input value.
-
getInversionConstant
protected double getInversionConstant()
Returns -1. if the sensor is inverted, or 1. otherwise.- Returns:
- The constant to multiple positions by for inversion.
-
-