TeamB/src/main/java/utils/AlphaPantherOp.java
/**
     * Method for driving the robot along any linear path
     *
     * @param driveDistanceMm Total displacement, must be greater than 0
     * @param bearingDeg Bearing of robot, in degress. Range: 0 < bearing < 360
     * @param speed Speed as a percentage of maximum motor speed. Range: 0 < speed <= 1
     */
Method for driving the robot along any linear path
@param driveDistanceMm Total displacement, must be greater than 0
@param bearingDeg Bearing of robot, in degress. Range: 0 < bearing < 360
@param speed Speed as a percentage of maximum motor speed.
Method for driving the robot along any linear path @param driveDistanceMm Total displacement must be greater than 0 @param bearingDeg Bearing of robot in degress . Range : 0 < bearing < 360 @param speed Speed as a percentage of maximum motor speed .
protected void linearDriveBearing(double driveDistanceMm, double bearingDeg, double speed)
    {
        driveDistanceMm = Math.abs(driveDistanceMm);
        if(bearingDeg <= 0 || bearingDeg >= 360)
        {
            tankDrive(driveDistanceMm, speed);
            return;
        }
        else if(bearingDeg == 90)
        {
            strafeDrive(driveDistanceMm, speed);
            return;
        }
        else if(bearingDeg == 180)
        {
            tankDrive(-driveDistanceMm, speed);
            return;
        }
        else if(bearingDeg == 270)
        {
            strafeDrive(-driveDistanceMm, speed);
            return;
        }
        boolean xNeg;
        boolean yNeg;
        double normalisedAngle;
        if(bearingDeg < 90)       { xNeg = false; yNeg = false; normalisedAngle = bearingDeg; }
        else if(bearingDeg < 180) { xNeg = false; yNeg = true;  normalisedAngle = bearingDeg - 90; }
        else if(bearingDeg < 270) { xNeg = true;  yNeg = true;  normalisedAngle = bearingDeg - 180; }
        else                      { xNeg = true;  yNeg = false; normalisedAngle = bearingDeg - 270; }
        double xDistance = (xNeg ? -1 : 1) * (driveDistanceMm * Math.cos(Math.toRadians(normalisedAngle)));
        double yDistance = (yNeg ? -1 : 1) * (driveDistanceMm * Math.sin(Math.toRadians(normalisedAngle)));
        linearDrive(xDistance, yDistance, speed);
    }
protected void linearDriveBearing ( double driveDistanceMm , double bearingDeg , double speed ) { driveDistanceMm = Math . abs ( driveDistanceMm ) ; if ( bearingDeg <= 0 || bearingDeg >= 360 ) { tankDrive ( driveDistanceMm , speed ) ; return ; } else if ( bearingDeg == 90 ) { strafeDrive ( driveDistanceMm , speed ) ; return ; } else if ( bearingDeg == 180 ) { tankDrive ( - driveDistanceMm , speed ) ; return ; } else if ( bearingDeg == 270 ) { strafeDrive ( - driveDistanceMm , speed ) ; return ; } boolean xNeg ; boolean yNeg ; double normalisedAngle ; if ( bearingDeg < 90 ) { xNeg = false ; yNeg = false ; normalisedAngle = bearingDeg ; } else if ( bearingDeg < 180 ) { xNeg = false ; yNeg = true ; normalisedAngle = bearingDeg - 90 ; } else if ( bearingDeg < 270 ) { xNeg = true ; yNeg = true ; normalisedAngle = bearingDeg - 180 ; } else { xNeg = true ; yNeg = false ; normalisedAngle = bearingDeg - 270 ; } double xDistance = ( xNeg ? - 1 : 1 ) * ( driveDistanceMm * Math . cos ( Math . toRadians ( normalisedAngle ) ) ) ; double yDistance = ( yNeg ? - 1 : 1 ) * ( driveDistanceMm * Math . sin ( Math . toRadians ( normalisedAngle ) ) ) ; linearDrive ( xDistance , yDistance , speed ) ; }
Method for driving the robot along any linear path
 @param driveDistanceMm Total displacement, must be greater than 0
 @param bearingDeg Bearing of robot, in degress.
Method for driving the robot along any linear path @param driveDistanceMm Total displacement must be greater than 0 @param bearingDeg Bearing of robot in degress .
// Trigonometry in order to figure out our X and Y components for displacement, then adjusted for polarity