Package com.ctre.phoenix6.hardware
Class Pigeon2
java.lang.Object
com.ctre.phoenix6.jni.CtreJniWrapper
com.ctre.phoenix6.hardware.ParentDevice
com.ctre.phoenix6.hardware.core.CorePigeon2
com.ctre.phoenix6.hardware.Pigeon2
- All Implemented Interfaces:
CommonDevice,Sendable,AutoCloseable
WPILib-integrated version of
CorePigeon2.-
Nested Class Summary
Nested classes/interfaces inherited from class com.ctre.phoenix6.hardware.ParentDevice
ParentDevice.MapGenerator -
Field Summary
Fields inherited from class com.ctre.phoenix6.hardware.ParentDevice
_emptyControl, deviceIdentifier -
Constructor Summary
ConstructorsConstructorDescriptionPigeon2(int deviceId) Constructs a new Pigeon 2 sensor object.Constructs a new Pigeon 2 sensor object.Deprecated, for removal: This API element is subject to removal in a future version.Constructing devices with a CAN bus string is deprecated for removal in the 2027 season. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()final Rotation2dReturns the heading of the robot as aRotation2d.final Rotation3dReturns the orientation of the robot as aRotation3dcreated from the quaternion signals.voidinitSendable(SendableBuilder builder) final voidreset()Resets the Pigeon 2 to a heading of zero.Methods inherited from class com.ctre.phoenix6.hardware.core.CorePigeon2
clearStickyFault_BootDuringEnable, clearStickyFault_BootDuringEnable, clearStickyFault_BootIntoMotion, clearStickyFault_BootIntoMotion, clearStickyFault_BootupAccelerometer, clearStickyFault_BootupAccelerometer, clearStickyFault_BootupGyroscope, clearStickyFault_BootupGyroscope, clearStickyFault_BootupMagnetometer, clearStickyFault_BootupMagnetometer, clearStickyFault_DataAcquiredLate, clearStickyFault_DataAcquiredLate, clearStickyFault_Hardware, clearStickyFault_Hardware, clearStickyFault_LoopTimeSlow, clearStickyFault_LoopTimeSlow, clearStickyFault_SaturatedAccelerometer, clearStickyFault_SaturatedAccelerometer, clearStickyFault_SaturatedGyroscope, clearStickyFault_SaturatedGyroscope, clearStickyFault_SaturatedMagnetometer, clearStickyFault_SaturatedMagnetometer, clearStickyFault_Undervoltage, clearStickyFault_Undervoltage, clearStickyFault_UnlicensedFeatureInUse, clearStickyFault_UnlicensedFeatureInUse, clearStickyFaults, clearStickyFaults, getAccelerationX, getAccelerationX, getAccelerationY, getAccelerationY, getAccelerationZ, getAccelerationZ, getAccumGyroX, getAccumGyroX, getAccumGyroY, getAccumGyroY, getAccumGyroZ, getAccumGyroZ, getAngularVelocityXDevice, getAngularVelocityXDevice, getAngularVelocityXWorld, getAngularVelocityXWorld, getAngularVelocityYDevice, getAngularVelocityYDevice, getAngularVelocityYWorld, getAngularVelocityYWorld, getAngularVelocityZDevice, getAngularVelocityZDevice, getAngularVelocityZWorld, getAngularVelocityZWorld, getConfigurator, getFault_BootDuringEnable, getFault_BootDuringEnable, getFault_BootIntoMotion, getFault_BootIntoMotion, getFault_BootupAccelerometer, getFault_BootupAccelerometer, getFault_BootupGyroscope, getFault_BootupGyroscope, getFault_BootupMagnetometer, getFault_BootupMagnetometer, getFault_DataAcquiredLate, getFault_DataAcquiredLate, getFault_Hardware, getFault_Hardware, getFault_LoopTimeSlow, getFault_LoopTimeSlow, getFault_SaturatedAccelerometer, getFault_SaturatedAccelerometer, getFault_SaturatedGyroscope, getFault_SaturatedGyroscope, getFault_SaturatedMagnetometer, getFault_SaturatedMagnetometer, getFault_Undervoltage, getFault_Undervoltage, getFault_UnlicensedFeatureInUse, getFault_UnlicensedFeatureInUse, getFaultField, getFaultField, getGravityVectorX, getGravityVectorX, getGravityVectorY, getGravityVectorY, getGravityVectorZ, getGravityVectorZ, getIsProLicensed, getIsProLicensed, getMagneticFieldX, getMagneticFieldX, getMagneticFieldY, getMagneticFieldY, getMagneticFieldZ, getMagneticFieldZ, getNoMotionCount, getNoMotionCount, getNoMotionEnabled, getNoMotionEnabled, getPitch, getPitch, getQuatW, getQuatW, getQuatX, getQuatX, getQuatY, getQuatY, getQuatZ, getQuatZ, getRawMagneticFieldX, getRawMagneticFieldX, getRawMagneticFieldY, getRawMagneticFieldY, getRawMagneticFieldZ, getRawMagneticFieldZ, getRoll, getRoll, getSimState, getStickyFault_BootDuringEnable, getStickyFault_BootDuringEnable, getStickyFault_BootIntoMotion, getStickyFault_BootIntoMotion, getStickyFault_BootupAccelerometer, getStickyFault_BootupAccelerometer, getStickyFault_BootupGyroscope, getStickyFault_BootupGyroscope, getStickyFault_BootupMagnetometer, getStickyFault_BootupMagnetometer, getStickyFault_DataAcquiredLate, getStickyFault_DataAcquiredLate, getStickyFault_Hardware, getStickyFault_Hardware, getStickyFault_LoopTimeSlow, getStickyFault_LoopTimeSlow, getStickyFault_SaturatedAccelerometer, getStickyFault_SaturatedAccelerometer, getStickyFault_SaturatedGyroscope, getStickyFault_SaturatedGyroscope, getStickyFault_SaturatedMagnetometer, getStickyFault_SaturatedMagnetometer, getStickyFault_Undervoltage, getStickyFault_Undervoltage, getStickyFault_UnlicensedFeatureInUse, getStickyFault_UnlicensedFeatureInUse, getStickyFaultField, getStickyFaultField, getSupplyVoltage, getSupplyVoltage, getTemperature, getTemperature, getTemperatureCompensationDisabled, getTemperatureCompensationDisabled, getUpTime, getUpTime, getVersion, getVersion, getVersionBugfix, getVersionBugfix, getVersionBuild, getVersionBuild, getVersionMajor, getVersionMajor, getVersionMinor, getVersionMinor, getYaw, getYaw, setControl, setYaw, setYaw, setYaw, setYawMethods inherited from class com.ctre.phoenix6.hardware.ParentDevice
getAppliedControl, getDeviceHash, getDeviceID, getNetwork, getResetOccurredChecker, hasResetOccurred, isConnected, isConnected, lookupStatusSignal, lookupStatusSignal, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilizationForAll, optimizeBusUtilizationForAll, optimizeBusUtilizationForAll, resetSignalFrequencies, resetSignalFrequencies, resetSignalFrequenciesForAll, setControlPrivate
-
Constructor Details
-
Pigeon2
Constructs a new Pigeon 2 sensor object.Constructs the device using the default CAN bus for the system (see
CANBus()).- Parameters:
deviceId- ID of the device, as configured in Phoenix Tuner
-
Pigeon2
Deprecated, for removal: This API element is subject to removal in a future version.Constructing devices with a CAN bus string is deprecated for removal in the 2027 season. Construct devices using aCANBusinstance instead.Constructs a new Pigeon 2 sensor object.- Parameters:
deviceId- ID of the device, as configured in Phoenix Tunercanbus- Name of the CAN bus this device is on. Possible CAN bus strings are:- "rio" for the native roboRIO CAN bus
- CANivore name or serial number
- SocketCAN interface (non-FRC Linux only)
- "*" for any CANivore seen by the program
- empty string (default) to select the default for the
system:
- "rio" on roboRIO
- "can0" on Linux
- "*" on Windows
-
Pigeon2
Constructs a new Pigeon 2 sensor object.- Parameters:
deviceId- ID of the device, as configured in Phoenix Tunercanbus- The CAN bus this device is on
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable
-
reset
Resets the Pigeon 2 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.
-
getRotation2d
Returns the heading of the robot as aRotation2d.The angle increases as the Pigeon 2 turns counterclockwise when looked at from the top. This follows the NWU axis convention.
The angle is continuous; that is, it will continue from 360 to 361 degrees. This allows for 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.
- Returns:
- The current heading of the robot as a
Rotation2d
-
getRotation3d
Returns the orientation of the robot as aRotation3dcreated from the quaternion signals.- Returns:
- The current orientation of the robot as a
Rotation3d
-
initSendable
- Specified by:
initSendablein interfaceSendable
-