|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
NavX Field-Centric drive (LabView)
Hello,
I noticed, after playing with the NavX from KuaiLabs a bit, that the GetYaw has a range from -180 to +180. My teams is planning to use field-centric driving. From a LabView perspective (using the Holonomic drive VI), will it take an input of -180 to +180? Also, how is the best way to "zero" the yaw? In other words, how can I let the robot which way North is (field-centrically)? Also, I looked at this example: https://code.google.com/p/navx-mxp/w...dOrientedDrive And it doesn't look like they compensated for the -180 to +180 range at all (we just added 180 to the output to get a 0-360 range) Thanks! |
|
#2
|
||||
|
||||
|
Re: NavX Field-Centric drive (LabView)
Quote:
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;
}
|
|
#3
|
||||
|
||||
|
Re: NavX Field-Centric drive (LabView)
Quote:
|
|
#4
|
||||
|
||||
|
Re: NavX Field-Centric drive (LabView)
Quote:
Same with Cosine. Try it in Excel or on your calculator. Or better yet, try it in a little LabVIEW program. |
|
#5
|
||||
|
||||
|
Re: NavX Field-Centric drive (LabView)
Duh! You're right. We'll try it out next time.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|