TeamB/src/main/java/utils/AlphaPantherOp.java
/**
     * Method for driving the robot along any linear path
     *
     * @param xDistanceMm Distance to be moved in X, in millimetres
     * @param yDistanceMm Distance to be moved in Y, in millimetres
     * @param speed Speed as a percentage of maximum motor speed. Range: 0 < speed <= 1
     */
Method for driving the robot along any linear path
@param xDistanceMm Distance to be moved in X, in millimetres
@param yDistanceMm Distance to be moved in Y, in millimetres
@param speed Speed as a percentage of maximum motor speed.
Method for driving the robot along any linear path @param xDistanceMm Distance to be moved in X in millimetres @param yDistanceMm Distance to be moved in Y in millimetres @param speed Speed as a percentage of maximum motor speed .
protected void linearDrive(double xDistanceMm, double yDistanceMm, double speed)
    {
        if(speed <= 0) { return; }
        if(!opModeIsActive()) { return; }
        int lfTarget, rfTarget, lbTarget, rbTarget;
        double displacementMagnitude = Math.sqrt((xDistanceMm*xDistanceMm) + (yDistanceMm*yDistanceMm));
        double lf_rbTemp = Range.clip(yDistanceMm + xDistanceMm, -displacementMagnitude, displacementMagnitude) * COUNTS_PER_MM;
        double rf_lbTemp = Range.clip(yDistanceMm - xDistanceMm, -displacementMagnitude, displacementMagnitude) * COUNTS_PER_MM;
        double maxTemp = Math.max(lf_rbTemp, rf_lbTemp);
        int maxDist = (int) maxTemp;
        lfTarget = lfWheel.getCurrentPosition () + (int) lf_rbTemp;
        rfTarget = rfWheel.getCurrentPosition () + (int) rf_lbTemp;
        lbTarget = lbWheel.getCurrentPosition () + (int) rf_lbTemp;
        rbTarget = rbWheel.getCurrentPosition () + (int) lf_rbTemp;
        double lfSpeed = speed * ((double)lfTarget / maxDist);
        double rfSpeed = speed * ((double)rfTarget / maxDist);
        double lbSpeed = speed * ((double)lbTarget / maxDist);
        double rbSpeed = speed * ((double)rbTarget / maxDist);
        encoderDrive(lfTarget, rfTarget, lbTarget, rbTarget, lfSpeed, rfSpeed, lbSpeed, rbSpeed);
    }
protected void linearDrive ( double xDistanceMm , double yDistanceMm , double speed ) { if ( speed <= 0 ) { return ; } if ( ! opModeIsActive ( ) ) { return ; } int lfTarget , rfTarget , lbTarget , rbTarget ; double displacementMagnitude = Math . sqrt ( ( xDistanceMm * xDistanceMm ) + ( yDistanceMm * yDistanceMm ) ) ; double lf_rbTemp = Range . clip ( yDistanceMm + xDistanceMm , - displacementMagnitude , displacementMagnitude ) * COUNTS_PER_MM ; double rf_lbTemp = Range . clip ( yDistanceMm - xDistanceMm , - displacementMagnitude , displacementMagnitude ) * COUNTS_PER_MM ; double maxTemp = Math . max ( lf_rbTemp , rf_lbTemp ) ; int maxDist = ( int ) maxTemp ; lfTarget = lfWheel . getCurrentPosition ( ) + ( int ) lf_rbTemp ; rfTarget = rfWheel . getCurrentPosition ( ) + ( int ) rf_lbTemp ; lbTarget = lbWheel . getCurrentPosition ( ) + ( int ) rf_lbTemp ; rbTarget = rbWheel . getCurrentPosition ( ) + ( int ) lf_rbTemp ; double lfSpeed = speed * ( ( double ) lfTarget / maxDist ) ; double rfSpeed = speed * ( ( double ) rfTarget / maxDist ) ; double lbSpeed = speed * ( ( double ) lbTarget / maxDist ) ; double rbSpeed = speed * ( ( double ) rbTarget / maxDist ) ; encoderDrive ( lfTarget , rfTarget , lbTarget , rbTarget , lfSpeed , rfSpeed , lbSpeed , rbSpeed ) ; }
Method for driving the robot along any linear path
 @param xDistanceMm Distance to be moved in X, in millimetres
 @param yDistanceMm Distance to be moved in Y, in millimetres
 @param speed Speed as a percentage of maximum motor speed.
Method for driving the robot along any linear path @param xDistanceMm Distance to be moved in X in millimetres @param yDistanceMm Distance to be moved in Y in millimetres @param speed Speed as a percentage of maximum motor speed .