Go to Post The imbalance and vibration is telling you something, you are not listening. - Al Skierkiewicz [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 30-01-2011, 11:31
wdell wdell is offline
Registered User
AKA: William Dell
FRC #3999 (Shadetree Mechanics)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Killeen, Texas
Posts: 55
wdell has a spectacular aura aboutwdell has a spectacular aura about
Need help with gyros

I'm getting some strange results when trying to read my gyroscope. As it sits there the gyro seems to accumulate angle: it will slowly count upwards, starting at zero and gradually drifting upwards into positive values. For the life of me I can't figure out why, with the robot sitting dead still, the gyro reading does not stay at zero. Anyone else have this problem?

Gyro test loop:
Code:
        // gyro test
        while (this.isDisabled()) {
        station.toLCDLine(3, "Gyro Test");
        double sensitivity = 0.000;
        //spinGyro.setSensitivity(sensitivity);
        String msg = "Sensitivity " + sensitivity;
        station.toLCDLine(4, msg);
        msg = "Heading " + getCurrentHeading();
        station.toLCDLine(5, msg)
Heading code, changes headings to plus or minus 180 degrees:
Code:
    public double getCurrentHeading() {
        double current = spinGyro.getAngle()%360;
        if (current > 180) {
            current = -(current - 360);
        }
        return current;
    }
Reply With Quote
  #2   Spotlight this post!  
Unread 30-01-2011, 12:08
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Need help with gyros

Quote:
Originally Posted by wdell View Post
For the life of me I can't figure out why, with the robot sitting dead still, the gyro reading does not stay at zero.
The gyro is a rate sensor. To get position, the library software integrates the rate. So if there is even the slightest null offset in the sensor, it will detect a non-zero rate even when perfectly still. When this non-zero rate is integrated, it will cause a slowly changing (angular) position.


Reply With Quote
  #3   Spotlight this post!  
Unread 31-01-2011, 08:44
wdell wdell is offline
Registered User
AKA: William Dell
FRC #3999 (Shadetree Mechanics)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Killeen, Texas
Posts: 55
wdell has a spectacular aura aboutwdell has a spectacular aura about
Re: Need help with gyros

Then I guess my next question is how do I fix it? Issuing a gyro.reset() command to return it to true constantly defeats the purpose of having a gyro to begin with.
Reply With Quote
  #4   Spotlight this post!  
Unread 31-01-2011, 08:57
alexhenning alexhenning is offline
WPILib Developer
FRC #0348
 
Join Date: Apr 2010
Rookie Year: 2003
Location: MA
Posts: 49
alexhenning will become famous soon enough
Re: Need help with gyros

Quote:
Originally Posted by wdell View Post
Then I guess my next question is how do I fix it? Issuing a gyro.reset() command to return it to true constantly defeats the purpose of having a gyro to begin with.
It depends what you are trying to do, if you just need it for maneuvers that take short periods of time resetting is usually good enough. It's also possible to take advantage of the temperature pins to increase the accuracy/reduce the drift. I've never actually done it, it won't eliminate the the problem, but it should reduce the drift.
Reply With Quote
  #5   Spotlight this post!  
Unread 31-01-2011, 10:54
wdell wdell is offline
Registered User
AKA: William Dell
FRC #3999 (Shadetree Mechanics)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Killeen, Texas
Posts: 55
wdell has a spectacular aura aboutwdell has a spectacular aura about
Re: Need help with gyros

Autodrive routine. I want it to go forward while keeping true. Positive drift of the gyro will generally cause the bot to slowly curve to the right. I was also playing with the idea of a one button "auto true", which would realign the bot to the scoring wall automatically.

I suppose I could use a floor function and round things off. Just bothers me that someone would build a gyro that doesn't hold true. I suppose I could build my own and measure the torque created when I turn it, but that kind of project is more for between competitions.
Reply With Quote
  #6   Spotlight this post!  
Unread 31-01-2011, 11:18
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Need help with gyros

Quote:
Originally Posted by wdell View Post
I'm getting some strange results when trying to read my gyroscope. As it sits there the gyro seems to accumulate angle: it will slowly count upwards, starting at zero and gradually drifting upwards into positive values.
How fast is the gyro drifting?


Reply With Quote
  #7   Spotlight this post!  
Unread 31-01-2011, 13:17
wdell wdell is offline
Registered User
AKA: William Dell
FRC #3999 (Shadetree Mechanics)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Killeen, Texas
Posts: 55
wdell has a spectacular aura aboutwdell has a spectacular aura about
Re: Need help with gyros

Quote:
Originally Posted by Ether View Post
How fast is the gyro drifting?

Not terribly fast in the grand scheme of things, but all those tiny errors accumulate over time until you aren't pointed right. Mostly I'm thinking in terms of auto-aiming the bot towards one end or another, and I can't do that if the bot is 45 degrees off but the gyro reads 63.
Reply With Quote
  #8   Spotlight this post!  
Unread 31-01-2011, 14:29
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Need help with gyros

Quote:
Originally Posted by wdell View Post
I can't do that if the bot is 45 degrees off but the gyro reads 63.
The match only lasts 2 minutes. The gyro calibrates to zero at power-up (at the start of the match).

I'm told that the gyro error at the end of 2 minutes is only about 1.5 degrees.


Reply With Quote
  #9   Spotlight this post!  
Unread 31-01-2011, 14:45
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,567
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Need help with gyros

Quote:
Originally Posted by Ether View Post
The match only lasts 2 minutes. The gyro calibrates to zero at power-up (at the start of the match).

I'm told that the gyro error at the end of 2 minutes is only about 1.5 degrees.

That was a calculation from the values that Itamar posted in that thread. Most gyros I've played with have had drifts in the 2-5 degrees per match range.
Reply With Quote
  #10   Spotlight this post!  
Unread 31-01-2011, 15:46
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Need help with gyros

Quote:
Originally Posted by Joe Ross View Post
That was a calculation from the values that Itamar posted in that thread. Most gyros I've played with have had drifts in the 2-5 degrees per match range.
Good to know. But that's still a far cry from 18 (=63-45) :-)


Reply With Quote
  #11   Spotlight this post!  
Unread 31-01-2011, 16:02
wdell wdell is offline
Registered User
AKA: William Dell
FRC #3999 (Shadetree Mechanics)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Killeen, Texas
Posts: 55
wdell has a spectacular aura aboutwdell has a spectacular aura about
Re: Need help with gyros

Quote:
Originally Posted by Ether View Post
Good to know. But that's still a far cry from 18 (=63-45) :-)

I was exaggerating I'll put a timer on it tonight and figure out the exact drift. Actually, I'll do it a few times, see if the drift is constant. If it is it'll be easy to correct depending on how long it's been since the last reset.
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:16.

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