public void polar(double magnitude,double direction,double rotation){
  magnitude=speedLimiter.applyAsDouble(magnitude) * SQRT_OF_TWO;
  double dirInRad=(direction + 45.0) * Math.PI / 180.0;
  double cosD=Math.cos(dirInRad);
  double sinD=Math.sin(dirInRad);
  double wheelSpeeds[]=new double[NUMBER_OF_MOTORS];
  wheelSpeeds[LEFT_FRONT]=(sinD * magnitude + rotation);
  wheelSpeeds[RIGHT_FRONT]=(cosD * magnitude - rotation);
  wheelSpeeds[LEFT_REAR]=(cosD * magnitude + rotation);
  wheelSpeeds[RIGHT_REAR]=(sinD * magnitude - rotation);
  normalize(wheelSpeeds);
  scale(wheelSpeeds,OUTPUT_SCALE_FACTOR);
  leftFront.setSpeed(wheelSpeeds[LEFT_FRONT]);
  leftRear.setSpeed(wheelSpeeds[LEFT_REAR]);
  rightFront.setSpeed(wheelSpeeds[RIGHT_FRONT]);
  rightRear.setSpeed(wheelSpeeds[RIGHT_REAR]);
}

public void polar ( double magnitude , double direction , double rotation ) { magnitude = speedLimiter . applyAsDouble ( magnitude ) * SQRT_OF_TWO ; double dirInRad = ( direction + 45.0 ) * Math . PI / 180.0 ; double cosD = Math . cos ( dirInRad ) ; double sinD = Math . sin ( dirInRad ) ; double wheelSpeeds [ ] = new double [ NUMBER_OF_MOTORS ] ; wheelSpeeds [ LEFT_FRONT ] = ( sinD * magnitude + rotation ) ; wheelSpeeds [ RIGHT_FRONT ] = ( cosD * magnitude - rotation ) ; wheelSpeeds [ LEFT_REAR ] = ( cosD * magnitude + rotation ) ; wheelSpeeds [ RIGHT_REAR ] = ( sinD * magnitude - rotation ) ; normalize ( wheelSpeeds ) ; scale ( wheelSpeeds , OUTPUT_SCALE_FACTOR ) ; leftFront . setSpeed ( wheelSpeeds [ LEFT_FRONT ] ) ; leftRear . setSpeed ( wheelSpeeds [ LEFT_REAR ] ) ; rightFront . setSpeed ( wheelSpeeds [ RIGHT_FRONT ] ) ; rightRear . setSpeed ( wheelSpeeds [ RIGHT_REAR ] ) ; }
polar drive method that specifies speeds in terms of magnitude and direction . this method does not use the drive ' s angle sensor .
