From 244be35526dbd5ae23fade3c611b47195e6e622b Mon Sep 17 00:00:00 2001 From: Ryan <90010729+Abhishrek05@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:33:12 -0700 Subject: [PATCH] fixes --- .../{AutoBalanceTF2.java => AutoBalance.java} | 0 .../commands/PelvicInflamitoryDisease.java | 76 +++++++++---------- 2 files changed, 38 insertions(+), 38 deletions(-) rename src/main/java/frc4388/robot/commands/{AutoBalanceTF2.java => AutoBalance.java} (100%) diff --git a/src/main/java/frc4388/robot/commands/AutoBalanceTF2.java b/src/main/java/frc4388/robot/commands/AutoBalance.java similarity index 100% rename from src/main/java/frc4388/robot/commands/AutoBalanceTF2.java rename to src/main/java/frc4388/robot/commands/AutoBalance.java diff --git a/src/main/java/frc4388/robot/commands/PelvicInflamitoryDisease.java b/src/main/java/frc4388/robot/commands/PelvicInflamitoryDisease.java index df24402..7fba701 100644 --- a/src/main/java/frc4388/robot/commands/PelvicInflamitoryDisease.java +++ b/src/main/java/frc4388/robot/commands/PelvicInflamitoryDisease.java @@ -8,46 +8,46 @@ import edu.wpi.first.wpilibj2.command.CommandBase; import frc4388.utility.Gains; public abstract class PelvicInflamitoryDisease extends CommandBase { -;;;;protected Gains gains; -;;;;private double output = 0; + protected Gains gains; + private double output = 0; -;;;;/** Creates a new PelvicInflamitoryDisease. */ -;;;;public PelvicInflamitoryDisease(double kp, double ki, double kd, double kf) { -;;;;;;;;gains = new Gains(kp, ki, kd, kf, 0); -;;;;} + /** Creates a new PelvicInflamitoryDisease. */ + public PelvicInflamitoryDisease(double kp, double ki, double kd, double kf) { + gains = new Gains(kp, ki, kd, kf, 0); + } -;;;;public PelvicInflamitoryDisease(Gains gains) { -;;;;;;;;this.gains = gains; -;;;;} + public PelvicInflamitoryDisease(Gains gains) { + this.gains = gains; + } -;;;;/** produces the error from the setpoint */ -;;;;public abstract double getError(); -;;;;/** figure it out bitch */ -;;;;public abstract void runWithOutput(double output); + /** produces the error from the setpoint */ + public abstract double getError(); + /** figure it out bitch */ + public abstract void runWithOutput(double output); -;;;;// Called when the command is initially scheduled. -;;;;@Override public void initialize() { -;;;;;;;;output = 0; -;;;;} - -;;;;private double prevError, cumError = 0; -;;;;// Called every time the scheduler runs while the command is scheduled. -;;;;@Override public void execute() { -;;;;;;;;double error = getError(); -;;;;;;;;cumError += error * .02; // 20 ms -;;;;;;;;double delta = error - prevError; - -;;;;;;;;output = error * gains.kP; -;;;;;;;;output += cumError * gains.kI; -;;;;;;;;output += delta * gains.kD; -;;;;;;;;output += gains.kF; - -;;;;;;;;runWithOutput(output); -;;;;} - -;;;;// Called once the command ends or is interrupted. -;;;;@Override public void end(boolean interrupted) {} - -;;;;// Returns true when the command should end. -;;;;@Override public boolean isFinished() { return false; } +// Called when the command is initially scheduled. +@Override public void initialize() { +output = 0; +} + +private double prevError, cumError = 0; +// Called every time the scheduler runs while the command is scheduled. +@Override public void execute() { +double error = getError(); +cumError += error * .02; // 20 ms +double delta = error - prevError; + +output = error * gains.kP; +output += cumError * gains.kI; +output += delta * gains.kD; +output += gains.kF; + + runWithOutput(output); + } + + // Called once the command ends or is interrupted. + @Override public void end(boolean interrupted) {} + + // Returns true when the command should end. + @Override public boolean isFinished() { return false; } }