View Single Post
  #1   Spotlight this post!  
Unread 28-03-2014, 21:26
Accentuate's Avatar
Accentuate Accentuate is offline
Registered User
FRC #4587 (Jersey Voltage)
Team Role: Programmer
 
Join Date: Jul 2013
Rookie Year: 2013
Location: Houston, TX
Posts: 2
Accentuate is an unknown quantity at this point
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:
public boolean hasPeriodPassed(double period) {
if (timer.getFPGATimestamp() < period * 1000000) {
return true;
}
else {
return false;
}
}
}
But we got no results when we tried it like this.

An example of where we implement Timer.delay looks like this:
Quote:
public void Fire() {
IntakeDown.set(false);
IntakeUp.set(true);
isIntakeUp = true;
Timer.delay(0.25);
shooterLatch.set(false);
shooterUnlatch.set(true);
Timer.delay(1.0);
isLatched = false;
isBottom = false;
isReset = false;
isFired = true;

}
If someone could point me in the right direction, it would be greatly appreciated.
Reply With Quote