View Single Post
  #51   Spotlight this post!  
Unread 07-02-2005, 12:36
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Example gyro code released.

Quote:
Originally Posted by marccenter
The software outputs a gyro bias of 4144?
To gain a few extra bits of precision, I oversample the analog output by a factor of eight and maintain that precision throughout all calculations. The bias should be around 8*512=4096. Sample rate and number of samples per update are both configurable by changing a few #defines in gyro.h.


Quote:
Originally Posted by marccenter
When, I swing the gryo 180 degrees in one direction, slowly, and return to zero I cannot get the gyro to indicate zero.
How far from zero is it?


Quote:
Originally Posted by marccenter
Any suggestions, Kevin.
Yes, just for grins, run the sampling rate up to 1600Hz and change the samples per update to 32 and try again. I've found it helpful to use a pushbutton(s) to force a bias calculation and/or heading angle reset. This code in the 38Hz control loop will do this for you:

Code:
static unsigned char old_io3_state = 1;
static unsigned char old_io4_state = 1;

// did user just push the bias calculation button?
if(rc_dig_in03 == 0 && old_io3_state == 1)
{
Start_Gyro_Bias_Calc();
printf("Calibrating...\n");
}

// did the user just release the bias calculation button?
if(rc_dig_in03 == 1 && old_io3_state == 0)
{
Stop_Gyro_Bias_Calc();
Reset_Gyro_Angle();
}

// did user just push the reset button?
if(rc_dig_in04 == 0 && old_io4_state == 1)
{
// reset the gyro angle to zero
Reset_Gyro_Angle();
}

// save the current button states
old_io3_state = rc_dig_in03;
old_io4_state = rc_dig_in04;

Quote:
Originally Posted by marccenter
BTW, I really believe the ADXRS300 EB scaling is not 5 mv /degree/sec but 7.5 mV/degree/sec. Plus/minus 300 degrees over 4.5 volt range, is 300 degrees over 2.25 volt range (2.5 to 4.75 or 2.5 to 0.25 volts).
or 2250 mV/300 degrees which is 7.5 mV/deg.

Scaling for Plus/Minus 75 degrees/ second is 30 mV/deg/sec
Scaling for Plus/Minus 150 degrees/second is 15 mV/deg/sec
scaling for plus/minus 300 degrees/second is 7.5 mV/deg/sec
Nope. It's 5.0 (+/- 0.4) mV/deg/sec.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org