mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[examples] Fix odometry update in SwerveControllerCommand example (#3310)
The Drive Subsystem was supplying an incorrectly constructed Rotation2d to the odometry update method. Rotation2d constructor was being called with heading in degrees, not radians as required.
This commit is contained in:
@@ -7,7 +7,6 @@ package edu.wpi.first.wpilibj.examples.swervecontrollercommand.subsystems;
|
||||
import edu.wpi.first.wpilibj.ADXRS450_Gyro;
|
||||
import edu.wpi.first.wpilibj.examples.swervecontrollercommand.Constants.DriveConstants;
|
||||
import edu.wpi.first.wpilibj.geometry.Pose2d;
|
||||
import edu.wpi.first.wpilibj.geometry.Rotation2d;
|
||||
import edu.wpi.first.wpilibj.interfaces.Gyro;
|
||||
import edu.wpi.first.wpilibj.kinematics.ChassisSpeeds;
|
||||
import edu.wpi.first.wpilibj.kinematics.SwerveDriveKinematics;
|
||||
@@ -68,7 +67,7 @@ public class DriveSubsystem extends SubsystemBase {
|
||||
public void periodic() {
|
||||
// Update the odometry in the periodic block
|
||||
m_odometry.update(
|
||||
new Rotation2d(getHeading()),
|
||||
m_gyro.getRotation2d(),
|
||||
m_frontLeft.getState(),
|
||||
m_rearLeft.getState(),
|
||||
m_frontRight.getState(),
|
||||
|
||||
Reference in New Issue
Block a user