Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Example gyro code released. (http://www.chiefdelphi.com/forums/showthread.php?t=32955)

neilsonster 21-01-2005 22:10

Re: Example gyro code released.
 
Quote:

For now, we are using the BEI gyrochip provided in the 2003 kit. This is for testing purposes, seeing as they are illegal for robot use.
Where did you hear they are illegal? Check the Q&A under ID 1118:
Quote:

Q: Can we use Gyros from previous year's kits on our robot?
A: Yes as long as it passes the 2005 Part Use Flowchart and you account for its cost according to the cost accounting rules.
EDIT: Nevermind... I guess the Q&A people didn't look up the price...

Tom Bottiglieri 21-01-2005 23:10

Re: Example gyro code released.
 
Quote:

Originally Posted by neilsonster
There shouldn't be a problem with you using the gyrochip on your robot.

Sweet, thanks for the info. I was under the impression it was illegal seeing as it was up for sale in a FIRST yard sale.

Kevin Watson 22-01-2005 00:16

Re: Example gyro code released.
 
Quote:

Originally Posted by Tom Bottiglieri
Sweet, thanks for the info. I was under the impression it was illegal seeing as it was up for sale in a FIRST yard sale.

I've updated the gyro code to include scaling factors for the two different BEI GyroChip gyros that FIRST has included in the KOP in the past. The code can be found here: http://kevin.org/frc.

-Kevin

CyberWolf_22 22-01-2005 00:45

Re: Example gyro code released.
 
I don't believe that the BEI gyro's are legal because the lowest price I have been able to find them for is approximately $350 which over the $200 price limit for additional electronics. If anyone has seen a gyro for sale cheaper then that, that would follow the vendor requirements that FIRST has laid out please post a link because I have 3 of them sitting in the shop that I would love to use on this years robot.

kutty18 22-01-2005 10:46

Re: Example gyro code released.
 
Quote:

Originally Posted by Kevin Watson
I have some serious magic that I can throw at the problem if people can't use their gyros because of too much drift.

Hmmm..Magic?...We tried to calibrate the gyro, but there was too much drift. We mounted it to a square piece of wood, but we still had too much drift. Is there any way to control the drift?

Thanks

Kevin Watson 22-01-2005 12:02

Re: Example gyro code released.
 
Quote:

Originally Posted by kutty18
Hmmm..Magic?...We tried to calibrate the gyro, but there was too much drift. We mounted it to a square piece of wood, but we still had too much drift. Is there any way to control the drift?

Thanks

What kind of gyro are you using? Did you try the manual method that uses Set_Gyro_Bias()? Just make sure the gyro is motionless as the bias is being calculated.

-Kevin

kutty18 22-01-2005 12:08

Re: Example gyro code released.
 
Quote:

Originally Posted by Kevin Watson
What kind of gyro are you using? Did you try the manual method that uses Set_Gyro_Bias()? Just make sure the gyro is motionless as the bias is being calculated.

-Kevin

We are using ADXRS300ABG & ADXRS300EB-ND Gyros. Yes we tried the manual method that uses Set_Gyro_Bias()?

Kevin Watson 22-01-2005 12:13

Re: Example gyro code released.
 
Quote:

Originally Posted by kutty18
We are using ADXRS300ABG & ADXRS300EB-ND Gyros. Yes we tried the manual method that uses Set_Gyro_Bias()?

How much drift are you seeing (you need to calibrate the scaling factor first).

-Kevin

neilsonster 22-01-2005 12:19

Re: Example gyro code released.
 
Quote:

Originally Posted by CyberWolf_22
I don't believe that the BEI gyro's are legal because the lowest price I have been able to find them for is approximately $350 which over the $200 price limit for additional electronics. If anyone has seen a gyro for sale cheaper then that, that would follow the vendor requirements that FIRST has laid out please post a link because I have 3 of them sitting in the shop that I would love to use on this years robot.

Ok, I just looked into this as well and you're right. The darn things are too expensive! (now we need to buy a new gyro..)

Edit: Actually, on second thought, does anyone know for sure if the fact that FIRST gave it to us in previous years makes a difference?

kutty18 22-01-2005 12:26

Re: Example gyro code released.
 
Quote:

Originally Posted by Kevin Watson
How much drift are you seeing (you need to calibrate the scaling factor first)

The values for "rate" and "angle" are empty in the terminal window. Once in a while, "angle" is 0. When we manually set Bias, the values for "rate" and "angle" are gibberish...Also, sometimes, the dreaded "windows fatal error" screen comes up. We have followed the steps that was in the readme.txt file. And no changes to the code were made...except for, changing to the right gyro model #.

Kevin Watson 22-01-2005 13:19

Re: Example gyro code released.
 
Quote:

Originally Posted by kutty18
...Also, sometimes, the dreaded "windows fatal error" screen comes up.

I think you'll need to find a different windows machine to use before you'll be able to make any progress.

-Kevin

kutty18 22-01-2005 17:53

Re: Example gyro code released.
 
Quote:

Originally Posted by Kevin Watson
I think you'll need to find a different windows machine to use before you'll be able to make any progress.

Hey, thanks. We got it to work. We took it to a "quiet" place, and it worked fine. Maybe its those machines that messed it up...

BradAMiller 23-01-2005 10:37

Re: Example gyro code released.
 
Quote:

Originally Posted by Kevin Watson
How much drift are you seeing (you need to calibrate the scaling factor first).

-Kevin

We used the code with the ADXRS300 as well and were seeing about 8 degrees of drift over 2-1/2 minutes on a motionless robot. We modified the code to average the bias over more than a single group of samples and increased the sample size to 16 to get the extra precision. That seemed to improve the results.

Can you tell us what you were seeing for drift over time? I just wasn't sure what to expect for results and so we tried these modifications.

Also, I have a question. You're locking the A/D onto Channel 1 to presumably eliminate that acquisition time when switching channels. How much time does actually take (for teams that want more than one analog input)?

And do you know what the conversion time is once the channel is switched?

Thanks again for posting the code.

Brad

Kevin Watson 23-01-2005 13:36

Re: Example gyro code released.
 
Quote:

Originally Posted by BradAMiller
We used the code with the ADXRS300 as well and were seeing about 8 degrees of drift over 2-1/2 minutes on a motionless robot. We modified the code to average the bias over more than a single group of samples and increased the sample size to 16 to get the extra precision. That seemed to improve the results.

Can you tell us what you were seeing for drift over time? I just wasn't sure what to expect for results and so we tried these modifications.

Without actively tracking the bias, you're getting performance that is about what I would expect from a ADXRS300. I'd be pretty happy with a gyro that only drifted a degree over the entire autonomous period. For reference, I have a ADXRS150EB that drifts a degree over about a minute and I tested an old GyroChip that did even better.


Quote:

Originally Posted by BradAMiller
Also, I have a question. You're locking the A/D onto Channel 1 to presumably eliminate that acquisition time when switching channels. How much time does actually take (for teams that want more than one analog input)?

No, I take control of the ADC hardware because I'm trying to be pretty efficient and not use up a lot of CPU time. You'll notice that in response to the timer interrupt, I read the ADC result register and then immediatly start another conversion. If you used the ADC after my conversion was done, I'd have lost the conversion result the next time the timer interrupt fires off. One way around this is to increase the timer interrupt rate and interleave the ADC measurements.


Quote:

Originally Posted by BradAMiller
And do you know what the conversion time is once the channel is switched?

I'm sure it's considerably less time than the timer interrupt period, but I don't know the exact value. The data sheet would be a good document to consult for this information.

-Kevin

Tom Bottiglieri 23-01-2005 13:38

Re: Example gyro code released.
 
Quote:

Originally Posted by Kevin Watson

No, I take control of the ADC hardware because I'm trying to be pretty efficient and not use up a lot of CPU time. You'll notice that in response to the timer interrupt, I read the ADC result register and then immediatly start another conversion. If you used the ADC after my conversion was done, I'd have lost the conversion result the next time the timer interrupt fires off. One way around this is to increase the timer interrupt rate and interleave the ADC measurements.
-Kevin

Is it possible for us to use the ADC for say.. another gyro?


All times are GMT -5. The time now is 05:29.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi