public class AnalogAccelerometer extends SensorBase implements PIDSource, LiveWindowSendable
Modifier and Type | Field and Description |
---|---|
protected PIDSourceType |
m_pidSource |
kAnalogInputChannels, kAnalogOutputChannels, kDigitalChannels, kPCMModules, kPDPChannels, kPDPModules, kPwmChannels, kRelayChannels, kSolenoidChannels, kSystemClockTicksPerMicrosecond
Constructor and Description |
---|
AnalogAccelerometer(AnalogInput channel)
Create a new instance of Accelerometer from an existing AnalogChannel.
|
AnalogAccelerometer(int channel)
Create a new instance of an accelerometer.
|
Modifier and Type | Method and Description |
---|---|
void |
free()
Delete the analog components used for the accelerometer.
|
double |
getAcceleration()
Return the acceleration in Gs.
|
PIDSourceType |
getPIDSourceType()
Get which parameter of the device you are using as a process control variable.
|
java.lang.String |
getSmartDashboardType()
The string representation of the named data type that will be used by the smart dashboard for
this
Sendable . |
ITable |
getTable()
The table that is associated with this
Sendable . |
void |
initTable(ITable subtable)
Initializes a table for this
Sendable object. |
double |
pidGet()
Get the Acceleration for the PID Source parent.
|
void |
setPIDSourceType(PIDSourceType pidSource)
Set which parameter of the device you are using as a process control variable.
|
void |
setSensitivity(double sensitivity)
Set the accelerometer sensitivity.
|
void |
setZero(double zero)
Set the voltage that corresponds to 0 G.
|
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.
|
checkAnalogInputChannel, checkAnalogOutputChannel, checkDigitalChannel, checkPDPChannel, checkPDPModule, checkPWMChannel, checkRelayChannel, checkSolenoidChannel, checkSolenoidModule, getDefaultSolenoidModule, setDefaultSolenoidModule
protected PIDSourceType m_pidSource
public AnalogAccelerometer(int channel)
The constructor allocates desired analog channel.
channel
- The channel number for the analog input the accelerometer is connected topublic AnalogAccelerometer(AnalogInput channel)
channel
- The existing AnalogInput object for the analog input the accelerometer is
connected topublic void free()
free
in class SensorBase
public double getAcceleration()
The acceleration is returned units of Gs.
public void setSensitivity(double sensitivity)
This sets the sensitivity of the accelerometer used for calculating the acceleration. The sensitivity varies by accelerometer model. There are constants defined for various models.
sensitivity
- The sensitivity of accelerometer in Volts per G.public void setZero(double zero)
The zero G voltage varies by accelerometer model. There are constants defined for various models.
zero
- The zero G voltage.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()
Sendable
Sendable
.getSmartDashboardType
in interface Sendable
Sendable
.public void initTable(ITable subtable)
Sendable
Sendable
object.public ITable getTable()
Sendable
Sendable
.public void updateTable()
LiveWindowSendable
updateTable
in interface LiveWindowSendable
public void startLiveWindowMode()
startLiveWindowMode
in interface LiveWindowSendable
public void stopLiveWindowMode()
stopLiveWindowMode
in interface LiveWindowSendable