Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Need help with gyros (http://www.chiefdelphi.com/forums/showthread.php?t=90509)

wdell 30-01-2011 11:31

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;
    }


Ether 30-01-2011 12:08

Re: Need help with gyros
 
Quote:

Originally Posted by wdell (Post 1011636)
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.



wdell 31-01-2011 08:44

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.

alexhenning 31-01-2011 08:57

Re: Need help with gyros
 
Quote:

Originally Posted by wdell (Post 1012312)
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.

wdell 31-01-2011 10:54

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.

Ether 31-01-2011 11:18

Re: Need help with gyros
 
Quote:

Originally Posted by wdell (Post 1011636)
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?



wdell 31-01-2011 13:17

Re: Need help with gyros
 
Quote:

Originally Posted by Ether (Post 1012394)
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.

Ether 31-01-2011 14:29

Re: Need help with gyros
 
Quote:

Originally Posted by wdell (Post 1012472)
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.



Joe Ross 31-01-2011 14:45

Re: Need help with gyros
 
Quote:

Originally Posted by Ether (Post 1012520)
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.

Ether 31-01-2011 15:46

Re: Need help with gyros
 
Quote:

Originally Posted by Joe Ross (Post 1012526)
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) :-)



wdell 31-01-2011 16:02

Re: Need help with gyros
 
Quote:

Originally Posted by Ether (Post 1012582)
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.


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

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