public class AnalogPotentiometer extends java.lang.Object implements Potentiometer, LiveWindowSendable
Modifier and Type | Field and Description |
---|---|
protected PIDSourceType |
m_pidSource |
Constructor and Description |
---|
AnalogPotentiometer(AnalogInput input)
AnalogPotentiometer constructor.
|
AnalogPotentiometer(AnalogInput input,
double scale)
AnalogPotentiometer constructor.
|
AnalogPotentiometer(AnalogInput input,
double fullRange,
double offset)
AnalogPotentiometer constructor.
|
AnalogPotentiometer(int channel)
AnalogPotentiometer constructor.
|
AnalogPotentiometer(int channel,
double scale)
AnalogPotentiometer constructor.
|
AnalogPotentiometer(int channel,
double fullRange,
double offset)
AnalogPotentiometer constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
free()
Frees this resource.
|
double |
get()
Get the current reading of the potentiometer.
|
PIDSourceType |
getPIDSourceType()
Get which parameter of the device you are using as a process control variable.
|
java.lang.String |
getSmartDashboardType()
Live Window code, only does anything if live window is activated.
|
ITable |
getTable()
The table that is associated with this
Sendable . |
void |
initTable(ITable subtable)
Initializes a table for this
Sendable object. |
double |
pidGet()
Implement the PIDSource interface.
|
void |
setPIDSourceType(PIDSourceType pidSource)
Set which parameter of the device you are using as a process control variable.
|
void |
startLiveWindowMode()
Analog Channels don't have to do anything special when entering the LiveWindow.
|
void |
stopLiveWindowMode()
Analog Channels don't have to do anything special when exiting the LiveWindow.
|
void |
updateTable()
Update the table for this sendable object with the latest values.
|
protected PIDSourceType m_pidSource
public AnalogPotentiometer(int channel, double fullRange, double offset)
Use the fullRange and offset values so that the output produces meaningful values. I.E: you have a 270 degree potentiometer and you want the output to be degrees with the halfway point as 0 degrees. The fullRange value is 270.0(degrees) and the offset is -135.0 since the halfway point after scaling is 135 degrees. This will calculate the result from the fullRange times the fraction of the supply voltage, plus the offset.
channel
- The analog channel this potentiometer is plugged into.fullRange
- The scaling to multiply the fraction by to get a meaningful unit.offset
- The offset to add to the scaled value for controlling the zero valuepublic AnalogPotentiometer(AnalogInput input, double fullRange, double offset)
Use the fullRange and offset values so that the output produces meaningful values. I.E: you have a 270 degree potentiometer and you want the output to be degrees with the halfway point as 0 degrees. The fullRange value is 270.0(degrees) and the offset is -135.0 since the halfway point after scaling is 135 degrees. This will calculate the result from the fullRange times the fraction of the supply voltage, plus the offset.
input
- The AnalogInput
this potentiometer is plugged into.fullRange
- The scaling to multiply the fraction by to get a meaningful unit.offset
- The offset to add to the scaled value for controlling the zero valuepublic AnalogPotentiometer(int channel, double scale)
Use the fullRange and offset values so that the output produces meaningful values. I.E: you have a 270 degree potentiometer and you want the output to be degrees with the halfway point as 0 degrees. The fullRange value is 270.0(degrees) and the offset is -135.0 since the halfway point after scaling is 135 degrees.
channel
- The analog channel this potentiometer is plugged into.scale
- The scaling to multiply the voltage by to get a meaningful unit.public AnalogPotentiometer(AnalogInput input, double scale)
Use the fullRange and offset values so that the output produces meaningful values. I.E: you have a 270 degree potentiometer and you want the output to be degrees with the halfway point as 0 degrees. The fullRange value is 270.0(degrees) and the offset is -135.0 since the halfway point after scaling is 135 degrees.
input
- The AnalogInput
this potentiometer is plugged into.scale
- The scaling to multiply the voltage by to get a meaningful unit.public AnalogPotentiometer(int channel)
channel
- The analog channel this potentiometer is plugged into.public AnalogPotentiometer(AnalogInput input)
input
- The AnalogInput
this potentiometer is plugged into.public double get()
get
in interface Potentiometer
public void setPIDSourceType(PIDSourceType pidSource)
PIDSource
setPIDSourceType
in interface PIDSource
pidSource
- An enum to select the parameter.public PIDSourceType getPIDSourceType()
PIDSource
getPIDSourceType
in interface PIDSource
public double pidGet()
public java.lang.String getSmartDashboardType()
getSmartDashboardType
in interface Sendable
Sendable
.public void initTable(ITable subtable)
Sendable
Sendable
object.public void updateTable()
LiveWindowSendable
updateTable
in interface LiveWindowSendable
public ITable getTable()
Sendable
Sendable
.public void free()
public void startLiveWindowMode()
startLiveWindowMode
in interface LiveWindowSendable
public void stopLiveWindowMode()
stopLiveWindowMode
in interface LiveWindowSendable