Modkit Gyro Straight line

Does anybody have a programing example for Modkit to use a gyro to keep your robot traveling in a straight line? I would like to use a gyro command with the drive command (drive (fwd)). Thanks


Here is some ModKit code that one of my teams used on a robot last year:

Their autonomous program would set that DRIVETIME variable to the number of seconds that they wanted it to drive, and broadcast DRIVESTRAIGHT. The math is such that if the robot turned a little bit, the Gyro’s rotation value would go up or down and add or subtract from the velocity of the left or right motors which would straighten the robot back up.

Hope this helps.


Gyro to Drive Striaght.png