public class AnalogAccelerometer extends SensorBase implements PIDSource, Sendable
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.
|
void |
initSendable(SendableBuilder builder)
Initializes 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.
|
checkAnalogInputChannel, checkAnalogOutputChannel, checkDigitalChannel, checkPDPChannel, checkPDPModule, checkPWMChannel, checkRelayChannel, checkSolenoidChannel, checkSolenoidModule, getDefaultSolenoidModule, setDefaultSolenoidModule
addChild, getName, getSubsystem, setName, setName, setName, setSubsystem
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName, getSubsystem, setName, setName, setSubsystem
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 SendableBase
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 void initSendable(SendableBuilder builder)
Sendable
Sendable
object.initSendable
in interface Sendable
builder
- sendable builder