![]() |
Java Timer.delay help
So we are trying to move away from Timer.Delay in our robot code because we are aware of the lag it brings to the whole robot when we are trying to reload the shooter. I am trying to find a way to implement a wait function with the Timer.getFPGATimestamp, but I'm drawing blanks on how to implement it.
I'm postulating that I'd have to implement by resetting the timer, then implementing something like this: Quote:
An example of where we implement Timer.delay looks like this: Quote:
|
Re: Java Timer.delay help
You don't need to multiply period. Timer.getFPGATimestamp() returns seconds; not milliseconds, microseconds or nanoseconds.
|
Re: Java Timer.delay help
Yeah I figured that, but when I deleted that part. It still did not work correctly.
|
Re: Java Timer.delay help
You need to save the current value of Timer.getFPGATimestamp() to compare it to, since it wont always be 0.
|
Re: Java Timer.delay help
Here is an example of setting/tracking a start time as you transition through your fire sequence. It is broken out into one private attribute (time the sequence was started) and three helper methods.
NOTE: This assumes you are programming using the SimpleRobot framework. Code:
// This will be set to the time when the fire sequence was started. It |
Re: Java Timer.delay help
We use edu.wpi.first.wpilibj.Timer liberally. See our Catapult subsystem code:
https://github.com/team3453/team3453.../Catapult.java |
| All times are GMT -5. The time now is 11:44. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi