View Single Post
  #2   Spotlight this post!  
Unread 28-01-2015, 00:21
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Gyro Drive Straight

If you know what direction you want the robot to face, and you know what direction it is currently facing, you can use the difference between them to control the "turn" input of either a Mecanum or Arcade drive function.

If you scale the values properly, that will tend to rotate the robot toward the desired direction. That's a simple Proportional control system, which is what the "P" in "PID" stands for. If you find that you can't get the robot to hold its direction strongly enough without overshooting and oscillating, then you need to implement a more complete PID control with some Integral to account for the steady-state error, and perhaps some Derivative to reduce overshoot when the error starts out too high.
Reply With Quote