Package edu.wpi.first.wpilibj
Class ADIS16470_IMU
java.lang.Object
edu.wpi.first.wpilibj.ADIS16470_IMU
- All Implemented Interfaces:
NTSendable
,Sendable
,AutoCloseable
public class ADIS16470_IMU extends Object implements AutoCloseable, NTSendable
This class is for the ADIS16470 IMU that connects to the RoboRIO SPI port.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ADIS16470_IMU.CalibrationTime
static class
ADIS16470_IMU.IMUAxis
-
Constructor Summary
Constructors Constructor Description ADIS16470_IMU()
ADIS16470_IMU(ADIS16470_IMU.IMUAxis yaw_axis, SPI.Port port, ADIS16470_IMU.CalibrationTime cal_time)
-
Method Summary
Modifier and Type Method Description void
calibrate()
Calibrate the gyro.void
close()
Delete (free) the spi port used for the IMU.int
configCalTime(ADIS16470_IMU.CalibrationTime new_cal_time)
Configures calibration timeint
configDecRate(int reg)
double
getAccelX()
double
getAccelY()
double
getAccelZ()
double
getAngle()
int
getPort()
Get the SPI port number.double
getRate()
double
getXComplementaryAngle()
double
getXFilteredAccelAngle()
ADIS16470_IMU.IMUAxis
getYawAxis()
double
getYComplementaryAngle()
double
getYFilteredAccelAngle()
void
initSendable(NTSendableBuilder builder)
Initializes thisSendable
object.boolean
isConnected()
void
reset()
int
setYawAxis(ADIS16470_IMU.IMUAxis yaw_axis)
Sets the yaw axis
-
Constructor Details
-
ADIS16470_IMU
public ADIS16470_IMU() -
ADIS16470_IMU
public ADIS16470_IMU(ADIS16470_IMU.IMUAxis yaw_axis, SPI.Port port, ADIS16470_IMU.CalibrationTime cal_time)- Parameters:
yaw_axis
- The axis that measures the yawport
- The SPI Port the gyro is plugged intocal_time
- Calibration time
-
-
Method Details
-
isConnected
-
configCalTime
Configures calibration time- Parameters:
new_cal_time
- New calibration time- Returns:
- 1 if the new calibration time is the same as the current one else 0
-
configDecRate
-
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. -
setYawAxis
Sets the yaw axis- Parameters:
yaw_axis
- The new yaw axis to use- Returns:
- 1 if the new yaw axis is the same as the current one, 2 if the switch to Standard SPI failed, else 0.
-
reset
-
close
Delete (free) the spi port used for the IMU.- Specified by:
close
in interfaceAutoCloseable
-
getAngle
- Returns:
- Yaw axis angle in degrees (CCW positive)
-
getRate
- Returns:
- Yaw axis angular rate in degrees per second (CCW positive)
-
getYawAxis
- Returns:
- Yaw Axis
-
getAccelX
- Returns:
- current acceleration in the X axis
-
getAccelY
- Returns:
- current acceleration in the Y axis
-
getAccelZ
- Returns:
- current acceleration in the Z axis
-
getXComplementaryAngle
- Returns:
- X axis complementary angle
-
getYComplementaryAngle
- Returns:
- Y axis complementary angle
-
getXFilteredAccelAngle
- Returns:
- X axis filtered acceleration angle
-
getYFilteredAccelAngle
- Returns:
- Y axis filtered acceleration angle
-
getPort
Get the SPI port number.- Returns:
- The SPI port number.
-
initSendable
Description copied from interface:NTSendable
Initializes thisSendable
object.- Specified by:
initSendable
in interfaceNTSendable
- Parameters:
builder
- sendable builder
-