|
Re: Gyro for driving straight
Quote:
Originally Posted by MrHollywood360
Can somebody please provide me with a basic example of how to use a gyro with tank drive to drive straight for a defined encoder distance during autonomous.
|
Examples will be easier to provide if you let us know what language you are coding in.
The basic approach it to add the gyro provided angle, time some gain factor, to one side of the drive and subtract it from the other.
Code:
Psuedo code:
L = L+(Gyro*gain1)
R = R-(Gyro*gain1)
Gain1 is adjusted high enought to correct drift, but low enough to prevent oscillation.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
|