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.FloatgetAngle()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.FloatgetMaxAngle()The maximal angle of this sensor.java.lang.FloatgetMinAngle()The minimal angle of this sensor.edu.wpi.first.wpilibj.PIDSourceTypegetPIDSourceType()java.lang.FloatgetPIDValue()Get the measured value of the sensor behind this PIDSrc.edu.wpi.first.wpilibj.pidwrappers.PIDAnalogPotentiometergetSensor()Get the sensor behind this PIDSrc.voidsetPIDSourceType(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:
getAnglein interfacePIDAngleValueSrc<edu.wpi.first.wpilibj.pidwrappers.PIDAnalogPotentiometer>- Returns:
- the angle value.
-
getPIDValue
public java.lang.Float getPIDValue()
Description copied from interface:PIDSrcGet the measured value of the sensor behind this PIDSrc.- Specified by:
getPIDValuein 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:
getMinAnglein 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:
getMaxAnglein 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:
getComposedComponentsin interfaceComposedComponent<edu.wpi.first.wpilibj.pidwrappers.PIDAnalogPotentiometer>- Returns:
- the composed components.
-
setPIDSourceType
public void setPIDSourceType(edu.wpi.first.wpilibj.PIDSourceType pidSourceType)
- Specified by:
setPIDSourceTypein interfaceedu.wpi.first.wpilibj.PIDSource
-
getPIDSourceType
public edu.wpi.first.wpilibj.PIDSourceType getPIDSourceType()
- Specified by:
getPIDSourceTypein interfaceedu.wpi.first.wpilibj.PIDSource
-
-