"

2013 FRC Java API

"

edu.wpi.first.wpilibj
Class AnalogPotentiometer

java.lang.Object
  extended by edu.wpi.first.wpilibj.AnalogPotentiometer
All Implemented Interfaces:
Potentiometer, LiveWindowSendable, PIDSource, Sendable

public class AnalogPotentiometer
extends Object
implements Potentiometer, LiveWindowSendable

Class for reading analog potentiometers. Analog potentiometers read in an analog voltage that corresponds to a position. Usually the position is either degrees or meters. However, if no conversion is given it remains volts.

Author:
Alex Henning

Nested Class Summary
 
Nested classes/interfaces inherited from interface edu.wpi.first.wpilibj.PIDSource
PIDSource.PIDSourceParameter
 
Constructor Summary
AnalogPotentiometer(int channel)
          AnalogPotentiometer constructor.
AnalogPotentiometer(int channel, double scale)
          AnalogPotentiometer constructor.
AnalogPotentiometer(int channel, double scale, double offset)
          AnalogPotentiometer constructor.
AnalogPotentiometer(int slot, int channel, double scale, double offset)
          AnalogPotentiometer constructor.
 
Method Summary
 double get()
          Get the current reading of the potentiomere.
 String getSmartDashboardType()
           
 ITable getTable()
          
 void initTable(ITable subtable)
          Initializes a table for this sendable object.
 double pidGet()
          Implement the PIDSource interface.
 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnalogPotentiometer

public AnalogPotentiometer(int slot,
                           int channel,
                           double scale,
                           double offset)
AnalogPotentiometer constructor. Use the scaling 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 scale value is 270.0(degrees)/5.0(volts) and the offset is -135.0 since the halfway point after scaling is 135 degrees.

Parameters:
slot - The analog module this potentiometer is plugged into.
channel - The analog channel this potentiometer is plugged into.
scale - The scaling to multiply the voltage by to get a meaningful unit.
offset - The offset to add to the scaled value for controlling the zero value

AnalogPotentiometer

public AnalogPotentiometer(int channel,
                           double scale,
                           double offset)
AnalogPotentiometer constructor. Use the scaling 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 scale value is 270.0(degrees)/5.0(volts) and the offset is -135.0 since the halfway point after scaling is 135 degrees.

Parameters:
channel - The analog channel this potentiometer is plugged into.
scale - The scaling to multiply the voltage by to get a meaningful unit.
offset - The offset to add to the scaled value for controlling the zero value

AnalogPotentiometer

public AnalogPotentiometer(int channel,
                           double scale)
AnalogPotentiometer constructor. Use the scaling 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 scale value is 270.0(degrees)/5.0(volts) and the offset is -135.0 since the halfway point after scaling is 135 degrees.

Parameters:
channel - The analog channel this potentiometer is plugged into.
scale - The scaling to multiply the voltage by to get a meaningful unit.

AnalogPotentiometer

public AnalogPotentiometer(int channel)
AnalogPotentiometer constructor.

Parameters:
channel - The analog channel this potentiometer is plugged into.
Method Detail

get

public double get()
Get the current reading of the potentiomere.

Specified by:
get in interface Potentiometer
Returns:
The current position of the potentiometer.

pidGet

public double pidGet()
Implement the PIDSource interface.

Specified by:
pidGet in interface PIDSource
Returns:
The current reading.

getSmartDashboardType

public String getSmartDashboardType()
Specified by:
getSmartDashboardType in interface Sendable
Returns:
the string representation of the named data type that will be used by the smart dashboard for this sendable

initTable

public void initTable(ITable subtable)
Initializes a table for this sendable object.

Specified by:
initTable in interface Sendable
Parameters:
subtable - The table to put the values in.

updateTable

public void updateTable()
Update the table for this sendable object with the latest values.

Specified by:
updateTable in interface LiveWindowSendable

getTable

public ITable getTable()

Specified by:
getTable in interface Sendable
Returns:
the table that is currently associated with the sendable

startLiveWindowMode

public void startLiveWindowMode()
Analog Channels don't have to do anything special when entering the LiveWindow. Start having this sendable object automatically respond to value changes reflect the value on the table.

Specified by:
startLiveWindowMode in interface LiveWindowSendable

stopLiveWindowMode

public void stopLiveWindowMode()
Analog Channels don't have to do anything special when exiting the LiveWindow. Stop having this sendable object automatically respond to value changes.

Specified by:
stopLiveWindowMode in interface LiveWindowSendable

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"