Created
February 22, 2017 00:52
-
-
Save auxiliary-character/2bac11741d6d5f4bb4d7460c3ecc73e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.usfirst.frc.team4009.robot; | |
import edu.wpi.first.wpilibj.SpeedController; | |
class CorrectionSpeedController implements SpeedController { | |
SpeedController actualController; | |
double correctionFactor; | |
public CorrectionSpeedController(SpeedController controller){ | |
actualController = controller; | |
} | |
public void setCorrection(double correction) { | |
correctionFactor = correction; | |
} | |
public double get() { | |
return actualController.get(); | |
} | |
public void set(double speed) { | |
actualController.set(speed * correctionFactor); | |
} | |
public void disable() { | |
actualController.disable(); | |
} | |
public void stopMotor(){ | |
actualController.stopMotor(); | |
} | |
public void setInverted(boolean isInverted){ | |
actualController.setInverted(isInverted); | |
} | |
public boolean getInverted() { | |
return actualController.getInverted(); | |
} | |
public void pidWrite(double output) { | |
actualController.pidWrite(output); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment