[examples] Replace gyro rotation with poseEstimator rotation (#5900)

This commit is contained in:
Elliot Scher
2023-11-10 18:12:54 -05:00
committed by GitHub
parent fa6b171e1c
commit cc2cbeb04c
4 changed files with 6 additions and 4 deletions

View File

@@ -147,7 +147,7 @@ public class Drivetrain {
ChassisSpeeds.discretize(
fieldRelative
? ChassisSpeeds.fromFieldRelativeSpeeds(
xSpeed, ySpeed, rot, m_gyro.getRotation2d())
xSpeed, ySpeed, rot, m_poseEstimator.getEstimatedPosition().getRotation())
: new ChassisSpeeds(xSpeed, ySpeed, rot),
periodSeconds));
mecanumDriveWheelSpeeds.desaturate(kMaxSpeed);

View File

@@ -71,7 +71,7 @@ public class Drivetrain {
ChassisSpeeds.discretize(
fieldRelative
? ChassisSpeeds.fromFieldRelativeSpeeds(
xSpeed, ySpeed, rot, m_gyro.getRotation2d())
xSpeed, ySpeed, rot, m_poseEstimator.getEstimatedPosition().getRotation())
: new ChassisSpeeds(xSpeed, ySpeed, rot),
periodSeconds));
SwerveDriveKinematics.desaturateWheelSpeeds(swerveModuleStates, kMaxSpeed);