Skip to content

Commit

Permalink
Merge branch 'main' into intake-subsystem
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanknj5 committed Aug 17, 2024
2 parents 9a57da2 + 6ef110c commit 6dc2686
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/frc/robot/imu/ImuState.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package frc.robot.imu;

public enum ImuState {
DEFAULT_STATE;
}
33 changes: 33 additions & 0 deletions src/main/java/frc/robot/imu/ImuSubsystem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package frc.robot.imu;

import com.ctre.phoenix6.hardware.Pigeon2;

import dev.doglog.DogLog;
import edu.wpi.first.math.geometry.Rotation2d;
import frc.robot.util.scheduling.SubsystemPriority;
import frc.robot.util.state_machines.StateMachine;

public class ImuSubsystem extends StateMachine<ImuState> {
private final Pigeon2 imu;
private Rotation2d robotHeading = new Rotation2d();

public ImuSubsystem(Pigeon2 imu) {
super(SubsystemPriority.IMU, ImuState.DEFAULT_STATE);
this.imu = imu;
}

@Override
protected void collectInputs() {
robotHeading = Rotation2d.fromDegrees(imu.getYaw().getValue());
}

public Rotation2d getRobotHeading() {
return robotHeading;
}

@Override
public void robotPeriodic() {
super.robotPeriodic();
DogLog.log("Imu/RobotHeading", robotHeading.getDegrees());
}
}

0 comments on commit 6dc2686

Please sign in to comment.