Package org.chsrobotics.lib.util
Class DeltaTimeUtil
java.lang.Object
org.chsrobotics.lib.util.DeltaTimeUtil
Class to simplify a common robot code action: getting a time elapsed between two points.
This class relies on WPI's Timer.getFPGATimestamp() method for its source of time.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the time elapsed between now and the comparison base.doubleReturns the time elapsed between now and the comparison base.
-
Constructor Details
-
DeltaTimeUtil
public DeltaTimeUtil()Constructs an instance of DeltaTimeUtil.The comparison base is initially set to the time as this is constructed.
-
-
Method Details
-
getTimeSecondsSinceLastCall
public double getTimeSecondsSinceLastCall()Returns the time elapsed between now and the comparison base. The comparison base is set to now after computation of the elapsed time.Time determined by WPI's
Timer.getFPGATimestamp()method.- Returns:
- Time, in seconds, elapsed between now and the comparison base.
-
getTimeSecondsSinceLastCallNoReset
public double getTimeSecondsSinceLastCallNoReset()Returns the time elapsed between now and the comparison base. The comparison base is not changed following this call.Time determined by WPI's
Timer.getFPGATimestamp()method.- Returns:
- Time, in seconds, elapsed between now and the comparison base.
-