View Single Post
  #12   Spotlight this post!  
Unread 11-01-2016, 04:49 PM
xjschwen xjschwen is offline
Registered User
FRC #3668
 
Join Date: Jan 2016
Location: Michigan
Posts: 18
xjschwen is an unknown quantity at this point
Re: Gyro vs. Encoders for Driving Straight

Quote:
Originally Posted by Tom Line View Post
I think you are traveling the wrong route - so to speak. 3 inches of drift left to right really isn't bad. The reality of driving with an FRC robot is that when you add up the drivetrain backlash, bumps, slips, and other mechanical losses you will never drive perfectly straight.

That's why vision, or sensors of some type are a necessity. It's the law of diminishing returns. You can spend weeks, or months working to get your robot to drive perfectly straight. But when you build your 2017 robot you will face a whole new set of challenges getting it perfect. Or you can spend that same time learning to utilize the vision examples so that when you hit a bump, or wall, or when you start using your new robot for 2017 you'll be able to hit a shot every time.

If you still want to continue optimizing driving straight, gerthworm nailed it.

The addition of a P term to each side of your drivetrain utilizing the gyro will get you darn close to perfect.

P is the proportional, or error term. It's calculated like this:

Proportional_Term = Constant * (Desired_Gyro_Angle - Actual_Gyro_Angle)
Left_Drive = Left_Drive + Proportional_Term
Right_Drive = Right_Drive - Proportional_Term


You may need to swap the +/- in the calculation depending on your drivetrain direction. Simply increase the constant term until you start driving straight. Start very small - like .05 or .1 for your Constant.

This is the most basic form of PID driving straight.

Edit: On another note, try not to saturate your drivetrain. That means try not to send it a full +1 or -1. There are a number of ways to scale the output so that you can still maintain straight driving at full speed.
we used this approach and were good enough to cross the ramparts, rock wall, moat, and terrain and still score a low goal about 50% of the time. We were always close to scoring as long as we did not run into another bot.
Reply With Quote