Thread: Robot Scan Time
View Single Post
  #7   Spotlight this post!  
Unread 19-01-2016, 19:28
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 430
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: Robot Scan Time

The time elapsed is going to be approximately 20ms, but it will fluctuate depending on network latencies.

Just perform the calculation each time through the loop.

Code:
currentTime = Timer.getFPGATimestamp(); //time in seconds
elapsedTime = currentTime - lastTime;

//do your math

lastTime = currentTime;
More info on what the getFPGATimestamp method does here: http://team2168.org/javadoc/edu/wpi/...PGATimestamp--
__________________
http://team2168.org

Last edited by otherguy : 19-01-2016 at 19:31.
Reply With Quote