Class LightningIMU
- java.lang.Object
 - 
- edu.wpi.first.wpilibj2.command.SubsystemBase
 - 
- com.lightningrobotics.common.subsystem.core.LightningIMU
 
 
 
- 
- All Implemented Interfaces:
 edu.wpi.first.util.sendable.Sendable,edu.wpi.first.wpilibj2.command.Subsystem
public class LightningIMU extends edu.wpi.first.wpilibj2.command.SubsystemBaseBase gyroscope type. Supports theNavXand thePigeon. 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceLightningIMU.IMUFunctionA generic function on the IMU to support lambda structurestatic classLightningIMU.IMUTypeSupported IMU types 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description edu.wpi.first.math.geometry.Rotation2dgetHeading()Get the IMU heading as aRotation2d.LightningIMU.IMUTypegetType()java.util.function.Supplier<edu.wpi.first.math.geometry.Rotation2d>heading()A function that can be used to get the heading of the IMUstatic LightningIMUnavX()Creates a newNavX.static LightningIMUnone()Creates a static IMUvoidperiodic()static LightningIMUpigeon(int id)Creates a newPigeonwith the given ID.voidreset()Reset IMU heading to 0LightningIMU.IMUFunctionzero()Function to reset IMU heading- 
Methods inherited from class edu.wpi.first.wpilibj2.command.SubsystemBase
addChild, getName, getSubsystem, initSendable, setName, setSubsystem 
 - 
 
 - 
 
- 
- 
Method Detail
- 
pigeon
public static LightningIMU pigeon(int id)
Creates a newPigeonwith the given ID.- Parameters:
 id- CAN ID of thePigeon- Returns:
 - IMU object configured for a 
Pigeon 
 
- 
navX
public static LightningIMU navX()
Creates a newNavX.- Returns:
 - IMU object configured for the NavX (SPI)
 
 
- 
none
public static LightningIMU none()
Creates a static IMU- Returns:
 - IMU object that effectively does nothing
 
 
- 
getType
public LightningIMU.IMUType getType()
 
- 
getHeading
public edu.wpi.first.math.geometry.Rotation2d getHeading()
Get the IMU heading as aRotation2d.- Returns:
 - The heading
 
 
- 
heading
public java.util.function.Supplier<edu.wpi.first.math.geometry.Rotation2d> heading()
A function that can be used to get the heading of the IMU- Returns:
 - A supplier of 
Rotation2dobjects. 
 
- 
reset
public void reset()
Reset IMU heading to 0 
- 
zero
public LightningIMU.IMUFunction zero()
Function to reset IMU heading- Returns:
 - An 
LightningIMU.IMUFunctionthat zeros the IMU heading when called 
 
- 
periodic
public void periodic()
 
 - 
 
 -