Pigeon2 get turn rate with MAX swerve module

Help with command to get turnrate
We are working on swerve code for our new chassis this year, and ran into an issue where the original command in the 2023 rev max swerve template did not work with our pigeon2
The original command was .getrate, and we messed around with some other commands to see if any work, and we couldn’t find any.

This is our current code for the command
anyone know of math or a command that we can use to get the turn rate?

  public double getTurnRate() {
    return m_gyro.getRawGyro(m_gyro.getRoll(), m_gyro.getPitch(), m_gyro.getYaw()) * (DriveConstants.kGyroReversed ? -1.0 : 1.0);
    //this is something close, xyz to roll pitch and yaw, see link below
    //.getrate replaced with .getrawgyro (https://www.chiefdelphi.com/t/does-pigeon-imu-have-an-equivalent-to-navx-getrate/375640)
  }
}
1 Like

m_gyro.getYaw() should do what you want as long as the pigeon is mounted flat facing up

1 Like

sorry for bad wording, we are trying to get the turn rate in degrees per second, not just the yaw at a certain point in time

1 Like

oh, i see, we had imported com.ctre.phoenix.sensors.Pigeon2; instead of importing com.ctre.phoenix.sensors.WPI_Pigeon2; hence why the .getrate command didnt show…
fixing right now

Do you know the difference between Pigeon2 and WPI_Pigeon2?
Edit: nvm

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.