Rotate To Angle (Frc) - Kauai Labs navX2-MXP User Manual

Robotics navigation sensor
Table of Contents

Advertisement

Examples
Field-Oriented Drive (FRC)
Full LabVIEW Source code on Github
Automatically rotating a robot to an angle using a navX-sensor can be used to rotate a robot quickly and
accurately to a known angle, as long as the robot drive system provides independent Z-axis rotation (the
capability to "spin on a dime"). This same technique can be used to help a robot drive in a straight line.
This example code below will automatically rotate the robot to one of four angles (0, 90, 180 and 270
degrees) whenever the corresponding "rotate to preset angle" button is pressed. This rotation can occur
not only when the robot is still, but also when the robot is driving. When using field-oriented control,
this will cause the robot to drive in a straight line, in whatever direction is selected.
This example also includes a feature allowing the driver to "reset" the "yaw" angle. When the reset
occurs, the new gyro angle will be 0 degrees. This can be useful in cases when the gyro drifts, which
doesn't typically happen during a FRC match, but can occur during long practice sessions.
The PID Controller coefficients defined in the example code will need to be tuned for your drive system.
NOTE: The examples below are for Mecanum drive systems. If you are using a tank (differential) drive

Rotate to Angle (FRC)

41

Advertisement

Table of Contents
loading

Related Products for Kauai Labs navX2-MXP

Table of Contents