Skip to content

Instantly share code, notes, and snippets.

@auxiliary-character
Created February 22, 2017 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save auxiliary-character/2bac11741d6d5f4bb4d7460c3ecc73e4 to your computer and use it in GitHub Desktop.
Save auxiliary-character/2bac11741d6d5f4bb4d7460c3ecc73e4 to your computer and use it in GitHub Desktop.
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