Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTinker64 committed Sep 22, 2024
1 parent d7354a4 commit cc54363
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
20 changes: 5 additions & 15 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,31 +53,21 @@ public RobotContainer() {
switch (Constants.currentMode) {
case REAL:
// Real robot, instantiate hardware IO implementations
drive =
new Drive(
new DriveIOReal(), new GyroIOPigeon2());
drive = new Drive(new DriveIOReal(), new GyroIOPigeon2());
break;

case SIM:
// Sim robot, instantiate physics sim IO implementations
drive =
new Drive(
new DriveIO() {

}, // Replace with sim once available
new GyroIO() {}
);
new DriveIO() {}, // Replace with sim once available
new GyroIO() {});
break;

default:
// Replayed robot, disable IO implementations
drive =
new Drive(
new DriveIO() {

},
new GyroIO() {}
);
drive = new Drive(new DriveIO() {}, new GyroIO() {});

break;
}

Expand Down
7 changes: 2 additions & 5 deletions src/main/java/frc/robot/subsystems/drive/Drive.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.util.GeneralUtil;

import java.util.function.Supplier;

import org.littletonrobotics.junction.Logger;

public class Drive extends SubsystemBase {
Expand All @@ -18,13 +16,11 @@ public class Drive extends SubsystemBase {

Rotation2d rawGyroRotation = new Rotation2d();


public Drive(DriveIO io, GyroIO gyroIO) {
this.io = io;
this.gyroIO = gyroIO;
}


public void periodic() {
io.updateInputs(driveInputs);
Logger.processInputs("Shooter/Feeder", driveInputs);
Expand All @@ -36,7 +32,8 @@ public void periodic() {
rawGyroRotation = gyroInputs.yawPosition;
} else {
// Use the angle delta from the kinematics and module deltas
Twist2d twist = DriveConstants.kinematics.toTwist2d(driveInputs.leftPosition, driveInputs.rightPosition);
Twist2d twist =
DriveConstants.kinematics.toTwist2d(driveInputs.leftPosition, driveInputs.rightPosition);
rawGyroRotation = rawGyroRotation.plus(new Rotation2d(twist.dtheta));
}
}
Expand Down

0 comments on commit cc54363

Please sign in to comment.