View Single Post
  #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