Class AsyncADXRS450_Gyro
- java.lang.Object
-
- edu.wpi.first.wpilibj.GyroBase
-
- edu.wpi.first.wpilibj.ADXRS450_Gyro
-
- io.github.frc5024.asynchal.sensors.AsyncADXRS450_Gyro
-
-
Constructor Summary
Constructors Constructor Description AsyncADXRS450_Gyro()
Default-construct an AsyncADXRS450_Gyro connected to the onboard SPI port
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkForUpdates()
Check for, and handle any updates since the last call.void
close()
void
registerAngleCallback(java.util.function.Consumer<java.lang.Double> callback)
Register a callback for changes in gyro angle in degrees.void
registerMotionCallback(java.lang.Runnable callback, double motionThreshold)
Register a callback for gyro motion.-
Methods inherited from class edu.wpi.first.wpilibj.ADXRS450_Gyro
calibrate, getAngle, getPort, getRate, isConnected, reset
-
Methods inherited from class edu.wpi.first.wpilibj.GyroBase
getPIDSourceType, initSendable, pidGet, setPIDSourceType
-
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
getRotation2d
-
Methods inherited from interface edu.wpi.first.wpilibj.PIDSource
getPIDSourceType, pidGet, setPIDSourceType
-
Methods inherited from interface edu.wpi.first.wpilibj.Sendable
addChild, getName, getSubsystem, initSendable, setName, setName, setName, setName, setSubsystem
-
-
-
-
Method Detail
-
checkForUpdates
public void checkForUpdates()
Description copied from interface:Pollable
Check for, and handle any updates since the last call. This should only be called from the Poller- Specified by:
checkForUpdates
in interfacePollable
-
registerAngleCallback
public void registerAngleCallback(java.util.function.Consumer<java.lang.Double> callback)
Register a callback for changes in gyro angle in degrees.- Parameters:
callback
- Callback function
-
registerMotionCallback
public void registerMotionCallback(java.lang.Runnable callback, double motionThreshold)
Register a callback for gyro motion. This is useful for detecting if a robot has been hit during aiming.- Parameters:
callback
- Callback functionmotionThreshold
- Threshold for motion in degrees
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Overrides:
close
in classADXRS450_Gyro
-
-