Kauai Labs navX-MXP User Manual page 42

Robotics navigation sensor
Table of Contents

Advertisement

Examples
Field-Oriented Drive (FRC)
strafe * cos(gyro_radians);
fwd = temp;
/* At this point, Joystick X/Y (strafe/forwrd) vectors have been
*/
/* rotated by the gyro angle, and can be sent to drive system */
The WPI Library "MecanumDrive_Cartesian()" function and the LabView "Holonomic Drive" VI,
which are used in the examples below, implement the field-centric drive algorithm. The navX-
MXP "Yaw" angle is provided to these library functions to specify the amount of rotation
between the robot and the field.
For more details on field-centric drive algorithms, please see this which provides a wealth of
helpful, well written information on implementing field-centric drive on various types of drive
systems.
FRC C++ Example
Full C++ source code on GitHub
FRC Java Example
Full Java Source code on GitHub
FRC LabView Example
The navX-MXP FieldCentric-Drive LabView example shows how to make small modifications to
the LabView "FRC RoboRIO Robot Project" using the "Mecanum Robot" configuration to
implement high-accuracy Field-Centric drive.
RobotMain.vi
Place the NavX main vi on the block diagram and set it up to your needs. The default sample
rate is 50Hz. You may need to process faster for your situation. For the SPI, I2C and USB
connections the max sample rate is 200Hz.
39

Hide quick links:

Advertisement

Table of Contents
loading

Related Products for Kauai Labs navX-MXP

Table of Contents