Quote:
Originally Posted by jojoguy10
From a LabView perspective (using the Holonomic drive VI), will it take an input of -180 to +180?
|
The Java WPILib code will. There's a good chance the LabVIEW will too.
It's a very simple vector rotation.
Code:
/**
* Rotate a vector in Cartesian space.
*/
protected static double[] rotateVector(double x, double y, double angle) {
double cosA = Math.cos(angle * (3.14159 / 180.0));
double sinA = Math.sin(angle * (3.14159 / 180.0));
double out[] = new double[2];
out[0] = x * cosA - y * sinA;
out[1] = x * sinA + y * cosA;
return out;
}
What's important is that the gyro angle is increasing in the clockwise direction.