From 35184281585a3c271c3f35512505f9667260dcdb Mon Sep 17 00:00:00 2001 From: michael-lesirge <100492377+michael-lesirge@users.noreply.github.com> Date: Thu, 28 Mar 2024 17:43:24 -0700 Subject: [PATCH] fix swerve field relative --- src/main/java/frc/robot/subsystems/SwerveDrivetrain.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/subsystems/SwerveDrivetrain.java b/src/main/java/frc/robot/subsystems/SwerveDrivetrain.java index a94fc65..88431a5 100644 --- a/src/main/java/frc/robot/subsystems/SwerveDrivetrain.java +++ b/src/main/java/frc/robot/subsystems/SwerveDrivetrain.java @@ -327,7 +327,7 @@ public void setDesiredState(ChassisSpeeds speeds, boolean fieldRelative) { SmartDashboard.putNumber("Spin", speeds.omegaRadiansPerSecond); if (fieldRelative) - speeds = ChassisSpeeds.fromFieldRelativeSpeeds(speeds, getHeading().plus(Rotation2d.fromDegrees(180))); + speeds = ChassisSpeeds.fromFieldRelativeSpeeds(speeds, getHeading()); speeds = ChassisSpeeds.discretize(speeds, TimedRobot.kDefaultPeriod); SwerveModuleState[] states = kinematics.toSwerveModuleStates(speeds);