Class Pigeon2
- All Implemented Interfaces:
Sendable
,AutoCloseable
-
Nested Class Summary
Nested classes/interfaces inherited from class com.ctre.phoenix6.hardware.ParentDevice
ParentDevice.MapGenerator<T>
-
Field Summary
Fields inherited from class com.ctre.phoenix6.hardware.ParentDevice
_emptyControl, deviceIdentifier
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
double
getAngle()
Deprecated, for removal: This API element is subject to removal in a future version.This API is deprecated for removal in the 2026 season.double
getRate()
Deprecated, for removal: This API element is subject to removal in a future version.This API is deprecated for removal in the 2026 season.Returns the heading of the robot as aRotation2d
.Returns the orientation of the robot as aRotation3d
created from the quaternion signals.void
initSendable
(SendableBuilder builder) void
reset()
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, setYaw
Methods inherited from class com.ctre.phoenix6.hardware.ParentDevice
getAppliedControl, getDeviceHash, getDeviceID, getNetwork, getResetOccurredChecker, hasResetOccurred, isConnected, isConnected, lookupStatusSignal, lookupStatusSignal, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilization, 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:
- "rio" on roboRIO
- "can0" on Linux
- "*" on Windows
- Parameters:
deviceId
- ID of the device, as configured in Phoenix Tuner.
-
Pigeon2
Constructs a new Pigeon 2 sensor object.- Parameters:
deviceId
- ID of the device, as configured in Phoenix Tuner.canbus
- The CAN bus this device is on.
-
Pigeon2
Constructs a new Pigeon 2 sensor object.- Parameters:
deviceId
- ID of the device, as configured in Phoenix Tuner.canbus
- 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
-
-
Method Details
-
close
- Specified by:
close
in 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.
-
getAngle
Deprecated, for removal: This API element is subject to removal in a future version.This API is deprecated for removal in the 2026 season. Users should useCorePigeon2.getYaw()
instead. Note that Yaw is CCW+, whereas this API is CW+.Returns the heading of the robot in degrees.The angle increases as the Pigeon 2 turns clockwise when looked at from the top. This follows the NED 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 in degrees
-
getRate
Deprecated, for removal: This API element is subject to removal in a future version.This API is deprecated for removal in the 2026 season. Users should useCorePigeon2.getAngularVelocityZWorld()
instead. Note that AngularVelocityZWorld is CCW+, whereas this API is CW+.Returns the rate of rotation of the Pigeon 2.The rate is positive as the Pigeon 2 turns clockwise when looked at from the top.
- Returns:
- The current rate in degrees per second
-
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 aRotation3d
created from the quaternion signals.- Returns:
- The current orientation of the robot as a
Rotation3d
-
initSendable
- Specified by:
initSendable
in interfaceSendable
-