Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/www/team847.wildgardenseed.com/lib/smarty/Smarty_Compiler.class.php on line 270
FIRST Team 847 PHRED - Gyroscope PID SubVI

Gyroscope PID SubVI

 

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/www/team847.wildgardenseed.com/lib/smarty/Smarty_Compiler.class.php on line 270
Download: gyro_PID_subvi.zip
PHRED Drive

Goal:
This subVI can be used to drive a robot in a straight line, compensating for motor bias and interference by other robots. The subVI requires an analog gyroscope.

Theory of Operation:
The subVI receives the gyro input. If the reading is off by over two degrees it sends out an output that replaces the y-axis input of the arcade drive block. Normally the y-axis input comes from the joystick. The PID controller prevents overcorrection by the gyro. The P value prevents most of the overcorrection. In testing, the value of 0.5 worked the best. The I and D worked best at zero. The gyro output is multiplied by 10 then multiplied by 0.1 to decrease sensitivity.

Code for Drive Straight subVI.Figure 1 - Code for Drive Straight subVI.
Inputs and outputs for Drive Straight subVIFigure 2 - Inputs and outputs for Drive Straight subVI

Our Application:
Our application of the subVI was to make the robot drive straight in both autonomous and teleoperated modes. We reset the gyro by sending a TRUE value to the reset. The PID gains are clustered. The angle output is optional, it doesn’t affect the operation. The output feeds to y-axis input of an arcade drive block.

Basic example for using the Drive Straight subVI.Figure 3 - Basic example for using the Drive Straight subVI.

Other Potential Applications:
Please contact Team 847 if you find other uses.

Hints and Warnings:
The robot cannot be moving when the power is turned on. The gyro will drift if the robot was moving. This has only been tested with an Analog Devices AD22305 gyro.

Download: gyro_PID_subvi.zip