Last edited by Chaud on Wed Mar 21, 2012 12:23 pm, edited 1 time in total.

Tue Jan 31, 2012 11:06 am

magicode

Moderator

Joined: Tue Sep 14, 2010 9:19 pmPosts: 496

Re: Gyro XV 3500CB angular rate sensor + PIC need some help

I've never worked with that specific sensor, so I don't know if I can help you with getting more accurate values, but I can try and answer some of your questions.

Chaud wrote:

And another question, if i rotate gyro to right , for example imagine i get 1,39V, but when hes stable again he backs to 1,34V, for what i read from gyroscopes isnt suposed to maintain 1,39V till gyro get back to original position (1,34V) ??

A gyroscope measures angular rate, so it has no idea what position it is at. It can only tell you how fast you're turning it. So when you turn it right, it will inform you that it is turning, and when you stop moving it, it will tell you that it is stopped. The gyro cannot tell the difference between being stopped at 0 degrees and being stopped at 90 degrees. The only way to determine angular position is to write your own program to integrate the gyro values and determine where the sensor is pointing.You said that you have trouble getting consistent and accurate values. It is very hard to turn the gyro at the same angular velocity every time. Perhaps that is the source of your error?As for not getting any value change when turning slowly, that sound like a threshold issue. Is there any way to change the threshold on that specific sensor, like a jumper or something?

_________________sudo rm -rf /

Tue Jan 31, 2012 11:24 am

jbflot

Site Admin

Joined: Tue May 15, 2007 9:02 amPosts: 409

Re: Gyro XV 3500CB angular rate sensor + PIC need some help

This is a program that simulates how we poll the official VEX Gryo. You will probably need to do some tweaking, but it should help:

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Gyro Driver Test//// This program emulates the gyro value calculation of ROBOTC's internal driver. It only emulates the value calculation.// It does not emulate the calculation of the bias values and relies upon the value calculated by the internal driver.//// When gyro driver starts up, it first calculates the internal bias value. The bias value is the analog value output// by the gyroscope while it is perfectly still. The steps to calculate the bias.//// 1. Delay for 200 milliseconds. This is to allow the gyro to stabilize when it is first powered up. The datasheet// indicates that this may take 50 milliseconds so we'll run it a little longer.//// 2. Measure the analog value every 0.001 seconds and calculate the sum over 1024 samples.//// 3. The bias can be calculated. Take the sum from (2) and divide by 1024.//// 4. Normally the remainder from (3) is non-zero. The remainder term is called the "small bias" by ROBOTC firmware.//// 5. Driver is now ready to calculate the gyro value.//// The gyro does not output an analog value representing angular position. Instead the value represents angular velocity.// To calculate angular position, you have to integrate periodically measured samples. The internal ROBOTC driver does// this is follows://// 1. Every millisecond it sums the "difference" of the current analog gyro value with the calculated bias value. This// effectively integrates the gyro velocity values into a gyro rotation value.//// 2. In (4) above there was a residual error (i.e. the small bias) calculated. So on every 1024 sums, the 'small bias'// is subtracted from the accumulated sum.//// 3. When user application program requests the gyro value, the accumulated sum is divided by the 'SensorScale' setting// to scale the result in tenths of a degree.//// 4. The analog gyro value has a lot of jitter; i.e. if the bias value is 1823 then the analog readings on a non-moving// gyro may be 1820 to 1826. The jitter does not appear to be uniformly distributed around the bias value. So the driver// has a "jitter filter" to ignore analog values that are within '4' (see '#define' for 'kJitterIgnoreRange') of the// bias value. This eliminates the//// 5. Even with point (4) above, there is a small drift in the gyro. This is typical of these gyro ICs. Over several minutes// the gyro value range -15 to +15 degrees (i.e. value of 150 in tenths of a degree) .////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////long nNumbOfADCConversionCycles = 0; // Performed by special debugging hook in firmware

task main(){ // Firmware retains sensor type setting between invocations of program. Explicitly setting to 'sensorNone' and // then back to 'sensorGyro' will explicitly force the firmware driver to recalculate the biase settings. Which // you may want to do via the Debugger's "STOP" and "START" buttons.

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum