public void arcade(double driveSpeed,double turnSpeed,boolean squaredInputs){
  double leftMotorSpeed;
  double rightMotorSpeed;
  driveSpeed=speedLimiter.applyAsDouble(driveSpeed);
  turnSpeed=speedLimiter.applyAsDouble(turnSpeed);
  if (squaredInputs) {
    if (driveSpeed >= 0.0) {
      driveSpeed=(driveSpeed * driveSpeed);
    }
 else {
      driveSpeed=-(driveSpeed * driveSpeed);
    }
    if (turnSpeed >= 0.0) {
      turnSpeed=(turnSpeed * turnSpeed);
    }
 else {
      turnSpeed=-(turnSpeed * turnSpeed);
    }
  }
  if (driveSpeed > 0.0) {
    if (turnSpeed > 0.0) {
      leftMotorSpeed=driveSpeed - turnSpeed;
      rightMotorSpeed=Math.max(driveSpeed,turnSpeed);
    }
 else {
      leftMotorSpeed=Math.max(driveSpeed,-turnSpeed);
      rightMotorSpeed=driveSpeed + turnSpeed;
    }
  }
 else {
    if (turnSpeed > 0.0) {
      leftMotorSpeed=-Math.max(-driveSpeed,turnSpeed);
      rightMotorSpeed=driveSpeed + turnSpeed;
    }
 else {
      leftMotorSpeed=driveSpeed - turnSpeed;
      rightMotorSpeed=-Math.max(-driveSpeed,-turnSpeed);
    }
  }
  left.setSpeed(leftMotorSpeed);
  right.setSpeed(rightMotorSpeed);
}

public void arcade ( double driveSpeed , double turnSpeed , boolean squaredInputs ) { double leftMotorSpeed ; double rightMotorSpeed ; driveSpeed = speedLimiter . applyAsDouble ( driveSpeed ) ; turnSpeed = speedLimiter . applyAsDouble ( turnSpeed ) ; if ( squaredInputs ) { if ( driveSpeed >= 0.0 ) { driveSpeed = ( driveSpeed * driveSpeed ) ; } else { driveSpeed = - ( driveSpeed * driveSpeed ) ; } if ( turnSpeed >= 0.0 ) { turnSpeed = ( turnSpeed * turnSpeed ) ; } else { turnSpeed = - ( turnSpeed * turnSpeed ) ; } } if ( driveSpeed > 0.0 ) { if ( turnSpeed > 0.0 ) { leftMotorSpeed = driveSpeed - turnSpeed ; rightMotorSpeed = Math . max ( driveSpeed , turnSpeed ) ; } else { leftMotorSpeed = Math . max ( driveSpeed , - turnSpeed ) ; rightMotorSpeed = driveSpeed + turnSpeed ; } } else { if ( turnSpeed > 0.0 ) { leftMotorSpeed = - Math . max ( - driveSpeed , turnSpeed ) ; rightMotorSpeed = driveSpeed + turnSpeed ; } else { leftMotorSpeed = driveSpeed - turnSpeed ; rightMotorSpeed = - Math . max ( - driveSpeed , - turnSpeed ) ; } } left . setSpeed ( leftMotorSpeed ) ; right . setSpeed ( rightMotorSpeed ) ; }
arcade drive implements single stick driving . this function lets you directly provide joystick values from any source .
