Class Pigeon2

All Implemented Interfaces:
CommonDevice, AutoCloseable

public class Pigeon2 extends CorePigeon2 implements AutoCloseable
WPILib-integrated version of CorePigeon2.
  • Constructor Details

    • Pigeon2

      public Pigeon2(int deviceId, CANBus canbus)
      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
  • Method Details

    • none

      public static Pigeon2 none()
      Constructs a stubbed-out Pigeon2, where all status signals, controls, configs, etc. perform no action and immediately return OK. This can be used to silence error messages for devices that have been completely removed from the robot.
      Returns:
      Stubbed-out Pigeon2
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • reset

      public final void 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

      public final org.wpilib.math.geometry.Rotation2d getRotation2d()
      Returns the heading of the Pigeon 2 as a Rotation2d.

      The angle increases as the Pigeon 2 turns counterclockwise when looked at from the top. This follows the NWU axis convention.

      Returns:
      The current heading of the Pigeon 2 as a Rotation2d
    • getRotation3d

      public final org.wpilib.math.geometry.Rotation3d getRotation3d()
      Returns the orientation of the Pigeon 2 as a Rotation3d created from the quaternion signals.
      Returns:
      The current orientation of the Pigeon 2 as a Rotation3d
    • getQuaternion

      public final org.wpilib.math.geometry.Quaternion getQuaternion()
      Returns the orientation of the Pigeon 2 as a Quaternion.
      Returns:
      The current orientation of the Pigeon 2 as a Quaternion