View Single Post
  #10   Spotlight this post!  
Unread 15-02-2006, 16:28
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,187
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Problem with gyro...

Quote:
Originally Posted by kaszeta
What's so hard about writing gyro code? Simple P-style feedback loop with the current heading and desired heading.

From an early version of my team's code, assuming you have Kevin's code in place already:

Code:
error=phi-theta;  // in milliradians
	
//Make sure you go the right way around the circle
if (error>3141L) {error-=6283;}
if (error<-3141L) {error+=6238;}
	
Kp=360;  

omega=(long)Kp*(long)error/2000L;

// Set limit bands
if(omega>64){omega=64;}
if(omega<-64){omega=-64;}

left_pwm-=omega; 
light_pwm-=omega;
Phi being wanted angle to stick to and theta being the measured angle?