@Tom
How does one determine the "gain?" Trial and error, algorithms, etc?
Would something like this be correct?
Code:
// Xbox Controller
Joystick Xbox = new Joystick(1);
// Drivetrain
public double throttle = Xbox.getRawAxis(3);
public double turn = applyDeadband(Xbox);
public double leftMtr = throttle + turn;
public double rightMtr = throttle + turn;
//This will need to be tuned
public double gain = 1;
private double applyDeadband(Joystick Xbox) {
if(Math.abs(Xbox.getRawAxis(1)) < 0.1) return 0;
else return Xbox.getRawAxis(1);
}
private double skim(double v) {
// gain determines how much to skim off the top
if (v > 1.0)
return -((v - 1.0) * gain);
else if (v < -1.0)
return -((v + 1.0) * gain);
return 0;
}
public double getLeftMotor() {
return leftMtr + skim(rightMtr);
}
public double getRightMotor() {
return rightMtr + skim(leftMtr);
}
@ Ether what are the benefits of your method vs Tom's? What would that code look like in Java?