![]() |
Re: Gyroscope Code
I found a minor bug in the gyro code.
The problem I was having is the Get_Gyro_Rate was all over the place. It would bounce between + and - during a turn. I added the long qualifiers to the GYRO_CAL_FACTOR and the problem went away. #define GYRO_CAL_FACTOR 1000L/1000L It must have been using an integer in there somewhere and it was overflowing. The problem didn't seem to affect the Get_Gyro_Angle routine. alan |
Re: Gyroscope Code
First of all, I would like to thank Mr. Watson for all the work he has put into FRC programming...you da man :] !
I have an ADXRS150EB Gyro. I loaded the standard EDU-gyro code from kevin.org onto an Edu controller and a bias of 1922 was calculated. The gyro is working perfectly, and all the angles I tested seemed reasonable. Now I move the gyro to a 2005 RC, and ran the 2006 Gyro code (with library and linker files changed to 2005). The bias was calculated to be 966 :confused:. The part if find even more odd, is that at the bias of 966 the gyro still appeared to work, except that if i rotated 90 deg, it thought it rotated ~70 deg. When the gyro wasnt moving, the rate was 0. I've looked through the EDU vs. FRC code, and I can't see anything that would cause the biases to be different. Notes: 1. No backup battery on FRC (main voltage was ~12.6) 2. Gyro is on a breadboard 3. No modifications made to code from kevin.org except change from milliradians to 1/10 deg 4. I tried the 2005 Gyro code and it worked perfectly. So its not my RC, there is something between the 2006 and 2005 Gyro code that I'm not seeing :o 5. I would be using a 2006 RC, but its being repaired by IFI at the moment...this code is intended for the 2006 RC, which is why I'm not using the 2005 Gyro code) Any help in getting the gyro working with the 2006 Gyro code on a 2005 RC would be greatly appreciated. Thanks a ton! |
Re: Gyroscope Code
Did you check to see which gyro is defined in gyro.h?
|
Re: Gyroscope Code
Yup, I made sure it was the ADXRS150 that was defined. (Sorry I forgot to mention that :p )
|
Re: Gyroscope Code
(Please see my previous post; otherwise this one might not make much sense)
Ok...another weird thing is happening. I wanted to continue coding, so I loaded the 2005 Gyro code (the code that works perfectly...no odd stuff happening). By default, Mr. Waston has all the printf's for gyro data in user_routines. So I turn the robot ~90 degrees, and the gyro reports it turned ~1570 milliradians. Wicked......now: I moved the gyro code that was in user_routines into the User_Autonomous_Code. (so the bias and all the output is now coming from autonomous mode). I also moved the Process_Gyro_Data as instructed. Now I turn the robot 90 degrees, and the gyro reports that it turned 1200 milliradians. Does anyone have any idea as to why the output I got (from the same code) is different just because I moved it to a different location? Again, any help would be much appreciated....I really am stumped. Notes: In a final attempt to prove that I wasn’t delusional :o ......I put the gyro data printf's in both autonomous and regular mode. (the bias was only being calculated once in regular mode). Now, I turned the robot ~90 degrees in regular mode, then turned autonomous on. I returned the robot to its orginal position and instead of reported ~0 heading, I got a heading of ~400 milliradians. :confused: |
Re: Gyroscope Code
Excuse me, Kevin, but during the Build of the Gyroscope code, an error is found stating GYRO_CAL_FACTOR is defined several times. However, after checking through the code, GYRO_CAL_FACTOR is defined once: double GYRO_CAL_FACTOR = 1000/1000;
What is the error? |
Re: Gyroscope Code
Quote:
-Kevin |
Gyro Problems
We hooked up our gyro today and are having some problems with it. We were running Kevin’s unmodified code and tried calibrating the scaling factor. After initializing, it returns 0 turn rate and 0 angle. If we rotate the gyro 180 degrees counter clockwise, it returns about -3100 milliradians. If we rotate it 180 degrees clockwise (after initializing), it reports about 2700 milliradians. If we rotate it 180 degrees back and forth, the angle value decreases an additional approx. 400 milliradians each cycle.
We also tried directly printing the gyro value from a Get_Analog_Value() statement while rotating the gyro by hand. At rest, we got a value of 505, turned rapidly in one direction, it would go to zero, but in the other direction, the highest it would go was about 780. Are we missing something? Might we have a defective gyro? Thanks. |
Re: Gyro Problems
Quote:
|
Re: Gyro Problems
Quote:
1. Is the gyro level? 2. Are you letting calculate the bias correctly (letting it sit a bit before running it)? 3. Are you turning it too quickly? |
Re: Gyro Problems
Quote:
Quote:
Quote:
|
Re: Gyro Problems
Quote:
-Kevin |
Re: Gyro Problems
Quote:
Thanks. |
Re: Gyro Problems
Quote:
I'll run some tests on our 2007 kit gyro (we're not using it, we decided again to use a ADXRS300EB since we can really spin our robot. We lose some precision, but make it up in overall accuracy). |
Re: Gyro Problems
Quote:
The 2004 RC should work fine assuming you compiled the code for the 18F8520, not the 18F8722. -Kevin |
| All times are GMT -5. The time now is 16:09. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi