Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
PGgit08 committed Jan 20, 2024
2 parents 4c78610 + 1334bc1 commit 360b2e0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/java/frc/robot/subsystems/SwerveDriveSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public class SwerveDriveSubsystem extends SubsystemBase {

private VisionSubsystem _visionSubsystem;

private double _robotSpeed = 0;

// estimated pose
private Pose2d _pose = new Pose2d();

Expand Down Expand Up @@ -143,6 +145,9 @@ public void periodic() {

_field.setRobotPose(_pose);
SmartDashboard.putData("FIELD", _field);

_robotSpeed = Math.sqrt(Math.pow(getRobotRelativeSpeeds().vxMetersPerSecond, 2) + Math.pow(getRobotRelativeSpeeds().vyMetersPerSecond, 2));
SmartDashboard.putNumber("DRIVE SPEED (m/s)", _robotSpeed);
}

/**
Expand Down Expand Up @@ -218,6 +223,8 @@ public Rotation2d getHeading() {
*/
public Rotation2d getHeadingRaw() {
return Rotation2d.fromDegrees(-Math.IEEEremainder(_gyro.getHeading(), 360));
}
}



}

0 comments on commit 360b2e0

Please sign in to comment.