gyro and accelerometer problems

Hey, we’re using kevin’s new 08 code (along with accelerometer we found on chiefdelphi), and when we disable the robot, it calibrates the gyro and the acceleromter. However, the gyro bias is -1, the rate is -21, and the angle never changes, even when we move the robot. Also, the accelerometer never yields any result but 0. Any ideas?

As far as the gyro goes, are you sure that the wires are connected to the pins labeled T, and not the ones labeled R? This has been a really common mistake for years.

no, i’m certain that that’s not the issue. They use the weirdest naming system…

Put in some printf’s in the ADC interrupt handler to make sure the analog input is updating.

Also, did you do these?

1) The gyro's rate output is wired to one of the analog inputs
of your robot controller and gyro.h/#define GYRO_CHANNEL is
updated with the analog channel your gyro is attached to.

2) The source code files gyro.c and gyro.h must be added to
your project.

3) A #include statement for the gyro.h header file must be 
included at the beginning of each source file that calls the 
functions in gyro.c. The statement should look like this: 
#include "gyro.h".

4) Initialize_Gyro() must be called from user_routines.c/
User_Initialization().

5) Process_Gyro_Data() must be called when the ADC software 
generates an update. An example of how to do this can be found
in user_routines_fast.c/Process_Data_From_Local_IO(). If you
use the gyro during autonomous period, Process_Gyro_Data()
must also be called from User_Autonomous_Code().

6) You must select the gyro you're using from a list in gyro.h
and if needed, remove the // in front of its #define. If you're
using the gyro from the 2006 KOP, use the default ADXRS150
gyro.

7) The default angular unit is milliradians. If desired, this
can be changed to tenths of a degree by editing gyro.h

8) A gyro bias calculation must take place using the functions 
Start_Gyro_Bias_Calc() & Stop_Gyro_Bias_Calc() described below.
This must be done several hundred milliseconds after the gyro 
powers-up and is allowed to stabilize.

9) For optimal performance, you'll need to calibrate the gyro 
scaling factor using the instructions above or those included
in gyro.h.

10) Follow the instructions found in adc_readme.txt for
installation instructions.

Because printf() is a big chunk of code to execute in an ISR, it’s probably better to just stuff an ASCII character directly into the serial port output queue, as described here.

-Kevin

OK! so! i think i figured out the problem! it was probably the combination of
A: the gyro being plugged into the wrong port (curse you electrical people!), and B: the fact that i hadn’t called Process_Gyro_Data() from Disabled_Spin()

OK! so now it isn’t working! I’ve called several print statements and writing chars. all the appropriate pieces get called, but the value of:

temp_gyro_rate = (int)Get_ADC_Result(GYRO_CHANNEL) - gyro_bias;

is always zero, even when we’re turning the robot. i’ve ensured that the number of ADC channels is greater than the number of our channel.

the gyro rate is generally around 30 or -31, but jumps around between these, even though the robot is still during calibration, and these don’t change when i’m rotating the robot

i’m completely stumped… could we need a new gyro?