View Single Post
  #8   Spotlight this post!  
Unread 15-02-2006, 16:25
kaszeta's Avatar
kaszeta kaszeta is offline
Registered User
FRC #0095 (Grasshoppers)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Lebanon, NH
Posts: 334
kaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of light
Re: Problem with gyro...

Quote:
Originally Posted by xolnian
Wheel slippage (unless you have wheels with no traction(which you shouldn't)) will not be a problem with a robot over 90 pounds, as long as you account for acceleration. Though this might sound iffy (or ifi ), the calculation is easier than writing code for the gyro.
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;