public class ADXRS450_Gyro extends GyroBase implements Gyro, PIDSource, LiveWindowSendable
This class is for the digital ADXRS450 gyro sensor that connects via SPI.
kAnalogInputChannels, kAnalogOutputChannels, kDigitalChannels, kPCMModules, kPDPChannels, kPDPModules, kPwmChannels, kRelayChannels, kSolenoidChannels, kSystemClockTicksPerMicrosecond
Constructor and Description |
---|
ADXRS450_Gyro()
Constructor.
|
ADXRS450_Gyro(SPI.Port port)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
calibrate()
Calibrate the gyro by running for a number of samples and computing the center value.
|
void |
free()
Delete (free) the spi port used for the gyro and stop accumulating.
|
double |
getAngle()
Return the actual angle in degrees that the robot is currently facing.
|
double |
getRate()
Return the rate of rotation of the gyro.
|
void |
reset()
Reset the gyro.
|
getPIDSourceType, getSmartDashboardType, getTable, initTable, pidGet, setPIDSourceType, startLiveWindowMode, stopLiveWindowMode, updateTable
checkAnalogInputChannel, checkAnalogOutputChannel, checkDigitalChannel, checkPDPChannel, checkPDPModule, checkPWMChannel, checkRelayChannel, checkSolenoidChannel, checkSolenoidModule, getDefaultSolenoidModule, setDefaultSolenoidModule
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPIDSourceType, pidGet, setPIDSourceType
startLiveWindowMode, stopLiveWindowMode, updateTable
getSmartDashboardType, getTable, initTable
public ADXRS450_Gyro()
public ADXRS450_Gyro(SPI.Port port)
port
- The SPI port that the gyro is connected topublic void calibrate()
Gyro
public void reset()
Gyro
public void free()
free
in interface Gyro
free
in class SensorBase
public double getAngle()
Gyro
The angle is based on the current accumulator value corrected by the oversampling rate, the gyro type and the A/D calibration values. The angle is continuous, that is it will continue from 360 to 361 degrees. This allows algorithms that wouldn't want to see a discontinuity in the gyro output as it sweeps past from 360 to 0 on the second time around.
This heading is based on integration of the returned rate from the gyro.