Package ca.team3161.lib.robot.pid
Class PotentiometerVoltagePIDSrc
- java.lang.Object
-
- ca.team3161.lib.robot.pid.PotentiometerVoltagePIDSrc
-
- All Implemented Interfaces:
PIDAngleValueSrc<edu.wpi.first.wpilibj.pidwrappers.PIDAnalogPotentiometer>
,PIDSrc<edu.wpi.first.wpilibj.pidwrappers.PIDAnalogPotentiometer,java.lang.Float>
,ComposedComponent<edu.wpi.first.wpilibj.pidwrappers.PIDAnalogPotentiometer>
,edu.wpi.first.wpilibj.PIDSource
public final class PotentiometerVoltagePIDSrc extends java.lang.Object implements PIDAngleValueSrc<edu.wpi.first.wpilibj.pidwrappers.PIDAnalogPotentiometer>, ComposedComponent<edu.wpi.first.wpilibj.pidwrappers.PIDAnalogPotentiometer>
A PID source that converts a rotary potentiometer's voltage output into degrees of rotation.
-
-
Constructor Summary
Constructors Constructor Description PotentiometerVoltagePIDSrc(edu.wpi.first.wpilibj.pidwrappers.PIDAnalogPotentiometer pot, float minVolt, float maxVolt, float minAngle, float maxAngle)
Create a new PotentiometerPidSrc instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Float
getAngle()
Get the angle measured by this sensor.java.util.Collection<edu.wpi.first.wpilibj.pidwrappers.PIDAnalogPotentiometer>
getComposedComponents()
Get the composed components within this one.java.lang.Float
getMaxAngle()
The maximal angle of this sensor.java.lang.Float
getMinAngle()
The minimal angle of this sensor.edu.wpi.first.wpilibj.PIDSourceType
getPIDSourceType()
java.lang.Float
getPIDValue()
Get the measured value of the sensor behind this PIDSrc.edu.wpi.first.wpilibj.pidwrappers.PIDAnalogPotentiometer
getSensor()
Get the sensor behind this PIDSrc.void
setPIDSourceType(edu.wpi.first.wpilibj.PIDSourceType pidSourceType)
-
-
-
Constructor Detail
-
PotentiometerVoltagePIDSrc
public PotentiometerVoltagePIDSrc(edu.wpi.first.wpilibj.pidwrappers.PIDAnalogPotentiometer pot, float minVolt, float maxVolt, float minAngle, float maxAngle)
Create a new PotentiometerPidSrc instance.- Parameters:
pot
- a Potentiometer object to measure voltages fromminVolt
- the minimum measured voltage from the potentiometer at the "small" movement endpoint of the systemmaxVolt
- the maximum measured voltage from the potentiometer at the "large" movement endpoint of the systemminAngle
- the minimum angle the system can physically rotate tomaxAngle
- the maximum angle the system can physically rotate to
-
-
Method Detail
-
getSensor
public edu.wpi.first.wpilibj.pidwrappers.PIDAnalogPotentiometer getSensor()
Get the sensor behind this PIDSrc.
-
getAngle
public java.lang.Float getAngle()
Get the angle measured by this sensor.- Specified by:
getAngle
in interfacePIDAngleValueSrc<edu.wpi.first.wpilibj.pidwrappers.PIDAnalogPotentiometer>
- Returns:
- the angle value.
-
getPIDValue
public java.lang.Float getPIDValue()
Description copied from interface:PIDSrc
Get the measured value of the sensor behind this PIDSrc.- Specified by:
getPIDValue
in interfacePIDSrc<edu.wpi.first.wpilibj.pidwrappers.PIDAnalogPotentiometer,java.lang.Float>
- Returns:
- the value.
-
getMinAngle
public java.lang.Float getMinAngle()
The minimal angle of this sensor.- Specified by:
getMinAngle
in interfacePIDAngleValueSrc<edu.wpi.first.wpilibj.pidwrappers.PIDAnalogPotentiometer>
- Returns:
- the minimal angle of this sensor
-
getMaxAngle
public java.lang.Float getMaxAngle()
The maximal angle of this sensor.- Specified by:
getMaxAngle
in interfacePIDAngleValueSrc<edu.wpi.first.wpilibj.pidwrappers.PIDAnalogPotentiometer>
- Returns:
- the maximal angle of this sensor
-
getComposedComponents
public java.util.Collection<edu.wpi.first.wpilibj.pidwrappers.PIDAnalogPotentiometer> getComposedComponents()
Get the composed components within this one.- Specified by:
getComposedComponents
in interfaceComposedComponent<edu.wpi.first.wpilibj.pidwrappers.PIDAnalogPotentiometer>
- Returns:
- the composed components.
-
setPIDSourceType
public void setPIDSourceType(edu.wpi.first.wpilibj.PIDSourceType pidSourceType)
- Specified by:
setPIDSourceType
in interfaceedu.wpi.first.wpilibj.PIDSource
-
getPIDSourceType
public edu.wpi.first.wpilibj.PIDSourceType getPIDSourceType()
- Specified by:
getPIDSourceType
in interfaceedu.wpi.first.wpilibj.PIDSource
-
-