View Single Post
  #8   Spotlight this post!  
Unread 30-01-2006, 16:04
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,077
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Manual Velocity PID, anyone successful?

Gyro yaw correction sample pseudocode:
--------
Angular_Vel = Gyro_Value - GYRO_CENTER;
Error = Desired_Angular_Vel - Angular_Vel; // Set Desired to 0 to go straight

Left_Drive += K * Angular_Vel;
Right_Drive -= K * Angular_Vel;

--------

Define K to be a constant somewhere.
The +/- may vary depending on the gyro orientation (upside down) or drivetrain definition of forward.
Also, be sure to check the bounds on your drive motors (final value must be between 0 and 254).
Watch the types (signed, unsigned, char, int) you choose so as not to overflow.