Go to Post Everyone together now, say 'thank you'. - ebarker [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
  #9   Spotlight this post!  
Unread 02-04-2012, 11:17 AM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,997
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: Integrating Gyro Code

Quote:
Originally Posted by RufflesRidge View Post
That depends what template is being used. In the Simple Template you add your own loop and it will not necessarily run every 20 ms, the TeleopPeriodic method of the Iterative template will run ~ every 20ms provided your code in that method returns in less than 20ms.

It also depends on what you are using the gyro for and if it has to keep track of it's orientation starting at the very beginning of the match. To do that you could make an object called something like CustomGyro that extends AnalogChannel and add the appropriate variables and code Ether listed. Instantiate a copy of your object in RobotInit, then call your CustomGyro.Integrate method from AutonomousPeriodic, TeleopPeriodic and DisabledPeriodic (if the robot might be turning at the beginning of auto and continue rotating a bit in disabled, otherwise leave this one out to avoid drift)

If you really need precision you probably need to calculate the delta time each time you go to integrate instead of trusting it to be ~20ms.
I'm not intimately familiar with the FRC Java Framework so I can't comment in detail about RufflesRidge's comments above, but I will add the following remarks:

Whatever rate you are doing the integration at, that's the cycle_time you should use in the integration. And, as mentioned above, if that rate is not expected to be very steady, it might help to measure the actual elapsed time each cycle and use that elapsed time in your calculation.

If you are concerned about gyro drift, you should add a button that the driver can press during the match to zero the gyro when it's at a known position.

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 08:17 AM.

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