- All Implemented Interfaces:
public class ADXRS450_Gyro extends Object implements Gyro, Sendable
This class is for the digital ADXRS450 gyro sensor that connects via SPI. Only one instance of an ADXRS Gyro is supported.
Constructors Constructor Description
Modifier and Type Method Description
calibrate()Calibrate the gyro.
close()Delete (free) the spi port used for the gyro and stop accumulating.
getAngle()Return the heading of the robot in degrees.
getPort()Get the SPI port number.
getRate()Return the rate of rotation of the gyro.
initSendable(SendableBuilder builder)Initializes this
isConnected()Determine if the gyro is connected.
reset()Reset the gyro.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface edu.wpi.first.wpilibj.interfaces.Gyro
ADXRS450_Gyropublic ADXRS450_Gyro()Constructor. Uses the onboard CS0.
ADXRS450_Gyropublic ADXRS450_Gyro(SPI.Port port)Constructor.
port- The SPI port that the gyro is connected to
isConnectedpublic boolean isConnected()Determine if the gyro is connected.
- true if it is connected, false otherwise.
calibratepublic void calibrate()Calibrate the gyro. It's important to make sure that the robot is not moving while the calibration is in progress, this is typically done when the robot is first turned on while it's sitting at rest before the match starts.
getPortpublic int getPort()Get the SPI port number.
- The SPI port number.
resetpublic void reset()Reset the gyro. Resets the gyro to a heading of zero. This can be used if there is significant drift in the gyro, and it needs to be recalibrated after it has been running.
closepublic void close()Delete (free) the spi port used for the gyro and stop accumulating.
- Specified by:
getAnglepublic double getAngle()Return the heading of the robot in degrees.
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.
The angle is expected to increase as the gyro turns clockwise when looked at from the top. It needs to follow the NED axis convention.
This heading is based on integration of the returned rate from the gyro.
getRatepublic double getRate()Return the rate of rotation of the gyro.
The rate is based on the most recent reading of the gyro analog value
The rate is expected to be positive as the gyro turns clockwise when looked at from the top. It needs to follow the NED axis convention.
initSendablepublic void initSendable(SendableBuilder builder)Description copied from interface:
- Specified by:
builder- sendable builder