Skip to content

Commit

Permalink
added the angle of the robot (from odometer) to the RobotState class
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaoHan2491 committed Dec 3, 2024
1 parent 7d03887 commit 24f2736
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/frc/robot/subsystems/DrivetrainSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ public double getHeadingLooped() {
public Rotation2d getGyroscopeRotation() {
return pigeon.getRotation2d();
}
/**
*
* @return a rotation2D of the angle according to the odometer
*/
public Rotation2d getOdometryRotation() {
return odometer.getEstimatedPosition().getRotation();
}
Expand Down Expand Up @@ -572,6 +576,7 @@ public void periodic() {

m_field.setRobotPose(odometer.getEstimatedPosition());
SmartDashboard.putNumber("Robot Angle", getOdometryRotation().getDegrees());
RobotState.getInstance().odometerOrientation = getOdometryRotation().getDegrees();
SmartDashboard.putString("Robot Location", getPose().getTranslation().toString());
SmartDashboard.putNumber("calculated speaker angle", calculateSpeakerAngleMoving());
SmartDashboard.putNumber("TESTING robot angle difference", getSpeakerAngleDifference());
Expand Down
1 change: 1 addition & 0 deletions src/main/java/frc/robot/subsystems/RobotState.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class RobotState {
public boolean LimelightsUpdated;
public boolean lightsReset;
public double intakeSensorVoltage;
public double odometerOrientation;

private RobotState() {

Expand Down

0 comments on commit 24f2736

Please sign in to comment.