Go to Post I need a This-Is-What-I-Meant checker. - N7UJJ [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 19-02-2012, 20:26
neal's Avatar
neal neal is offline
Neal
FRC #1777 (Viking Robotics)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2009
Location: United States
Posts: 56
neal is an unknown quantity at this point
Gyro value not consistent

We have used a gyro before and in fact, we are using the same one this year that we used last year. I'm not sure what setSensitivity does, but I have it set to default (0.007).

If I reset the gyro, and read the angle, it stays around 0. And if I move 30 degrees, gyro.getAngle() does change from 0 to 30, but after that it keeps on moving up slowly even if the robot stops moving. It's really slow but it changes from 30 to 33 in 15 seconds.

I am pretty sure this did not happen last year. We will try a different gyro tomorrow.

If there's anything else we could check or if there's something we're doing wrong, any suggestions are appreciated!

Thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 29-03-2012, 18:14
deeek deeek is offline
Registered User
None #1329
 
Join Date: Jan 2010
Location: St. Louis
Posts: 17
deeek is an unknown quantity at this point
Re: Gyro value not consistent

Did you happen to find a solution to this problem? We're experiencing this as well. This didn't happen last, or even last summer.
Reply With Quote
  #3   Spotlight this post!  
Unread 30-03-2012, 01:08
JamesW_CB JamesW_CB is offline
Registered User
FRC #3189
 
Join Date: Mar 2012
Location: Diamond Springs
Posts: 3
JamesW_CB is an unknown quantity at this point
Re: Gyro value not consistent

We used a filter formula with an accelerometer to correct the drift of our gyro, Ill post the formula and details tomorrow, as I am posting from my phone
Reply With Quote
  #4   Spotlight this post!  
Unread 30-03-2012, 17:31
JamesW_CB JamesW_CB is offline
Registered User
FRC #3189
 
Join Date: Mar 2012
Location: Diamond Springs
Posts: 3
JamesW_CB is an unknown quantity at this point
Re: Gyro value not consistent

Here is the raw code, I'll explain it... (supaGyro is just a gyro lol):

Code:
// Get the Gyro Angle and Filter it
xAngle = Math.toDegrees(getAxesMeasurements().XAxis);
xAngleFiltered = Constants.hfc * xAngleFiltered + (1 - Constants.hfc) * xAngle;
gyroError = xAngleFiltered - supaGyro.getAngle();
// Get the actual Angle of the bot
angle = Constants.lfc * ((angle + (supaGyro.getAngle() + gyroError)) / 2) + (1 - Constants.lfc) * xAngle;
Basicly the first line of code takes the Accelerometer X-Axis (It would be Y-Axis if the Accelerometer was laying flat) and converts it to degrees...

The second line filters the X-axis and causes it to return a more stable reading (HFC is Heavy filter constant)

the Third line calculates how much the gyro is drifting

The fourth, acually corrects the drift on the gyro, the value wont change unless the accelerometer is moving... It works great for our Gyro

our HFC = 0.9 and LFC = 0.98

We use a gyro for automatic balance, it works well.

Ill give a more complete post with a formula where we derived our code from, but im late for a robotics meeting
Reply With Quote
  #5   Spotlight this post!  
Unread 23-04-2012, 19:16
sebflippers sebflippers is offline
Registered User
FRC #2914
 
Join Date: Jan 2012
Location: dc
Posts: 56
sebflippers will become famous soon enoughsebflippers will become famous soon enough
Re: Gyro value not consistent

The kalman filter (https://en.wikipedia.org/wiki/Kalman_filter) is something that you should learn to use. It is used for filtering stuff like that (accelerometer and Gyro). When done right, It is called an IMU (inertial measurement unit). Gyro drift is standard. It is kinda weird that it somehow got worse.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 22:41.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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