Go to Post "So [you're] like battlebots" Standard answer: No -- it's better! - Roger [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 12-02-2014, 05:54
pblankenbaker pblankenbaker is offline
Registered User
FRC #0868
 
Join Date: Feb 2012
Location: Carmel, IN, USA
Posts: 103
pblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of light
Re: Gyro reset() troubles

My understanding of the gyro is that a reset is not instantaneous. It takes a bit of time for the gryo to zero itself and during this time it is best not to move. If you changed your code to the following, you might be more likely to see a value closer to zero:

Code:
public void resetGyro() {
    double before = getGyroAngle();
    gyro.reset();
    Timer.delay(2.0);
    System.out.println("Gyro Before: " + before + " After: " + getGyroAngle());
}
Adding delays to wait for the gyro to initialize is undesirable. Our general approach has been:
  • Avoid resetting the gyro (maybe reset it once during initialization, but avoid it during the autonomous and teleop periods).
  • Make autonomous turns based off the current gyro setting. For example, if the want to rotate 90 degrees, use (90.0 + getGryoAngle()) as your destination instead of resetting and using 90.0.
  • Add a smart dashboard button to reset the gyro while testing.
  • Determine a gain correction for the gyro and apply this to each reading. For example, if you rotate the robot 10 times and the gryo reports 3500 degrees, the gain correction would be (3600.0 / 3500.0) and you would then multiply the raw values reported by the gyro using this gain correction factor.

Hope that helps,
Paul
Reply With Quote
 


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 11:28.

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