Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
SFUnityTeamAccount committed Nov 23, 2024
2 parents 6be03db + 1049873 commit 9f5e872
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/java/frc/robot/subsystems/drive/DriveIOSim.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import edu.wpi.first.wpilibj.simulation.DifferentialDrivetrainSim.KitbotGearing;
import edu.wpi.first.wpilibj.simulation.DifferentialDrivetrainSim.KitbotMotor;
import edu.wpi.first.wpilibj.simulation.DifferentialDrivetrainSim.KitbotWheelSize;
import frc.robot.util.loggedShuffleboardClasses.LoggedShuffleboardNumber;

public class DriveIOSim implements DriveIO {
private DifferentialDrivetrainSim sim =
Expand All @@ -29,6 +30,8 @@ public class DriveIOSim implements DriveIO {
private double leftAppliedVolts = 0.0;
private double rightAppliedVolts = 0.0;

public LoggedShuffleboardNumber speedsMultiplier = new LoggedShuffleboardNumber(null, null, leftAppliedVolts);

@Override
public void updateInputs(DriveIOInputs inputs) {
sim.update(0.02);
Expand All @@ -48,8 +51,10 @@ public void updateInputs(DriveIOInputs inputs) {
@Override
public void arcadeDrive(double xSpeed, double omegaRotation) {
var speeds = DifferentialDrive.arcadeDriveIK(xSpeed, omegaRotation, true);
leftAppliedVolts = MathUtil.clamp(speeds.left * 12.0, -12.0, 12.0);
rightAppliedVolts = MathUtil.clamp(speeds.right * 12.0, -12.0, 12.0);
// leftAppliedVolts = MathUtil.clamp(speeds.left * 12.0, -12.0, 12.0);
// rightAppliedVolts = MathUtil.clamp(speeds.right * 12.0, -12.0, 12.0);
leftAppliedVolts = speeds.left * speedsMultiplier;
rightAppliedVolts = speeds.right * speedsMultiplier;
sim.setInputs(leftAppliedVolts, rightAppliedVolts);
}
}

0 comments on commit 9f5e872

Please sign in to comment.