RobotCasserole1736 / CasseroleLib

Common Libraries used year-to-year for FRC robot code
MIT License
6 stars 1 forks source link

Create Hourmeter class #11

Closed gerth2 closed 8 years ago

gerth2 commented 8 years ago

A request was made to record the total operational time of the robot to help with bench-marking mechanical performance of parts (did it last 1 hour? 5 hours? etc.), as well as just general cool factor.

As marked, this is low priority, but still a possibility.

Requirements: A special "hourmeter.txt" file should be created at a hard-coded and specific location on the RIO's hard drive. When initialized, the class should read from this file to determine how long the robot has already been run for.

Provide methods to be called during any of the robot's init() methods. These should change the state of the hourmeter program and mark the start time of each mode. The hourmeter should track autonomous time, teleop time, and total time. If the robot is in either auto or teleop, the appropriate time counts should be updated every five seconds. It is acceptable to have a second or two of error here and there, as this time count is looking for "macro" trends. However, it should be robust against shutting down the robot without going to disabled (ie, if i'm in teleop for ten minutes, and I just hit the powerswitch on the robot, I shouldn't lose all ten minutes off of the time counters)

Note i'm calling this an "hourmeter" because that's what the rest of the world calls this feature. However, since our robot runs on smaller timeframes, the time should actually be recorded in fractional minutes (ie, 30 seconds gets recorded as "0.5").

hourmeter.txt should be human-readable for debugging, and the method should provide methods for reading all current hour readings, as well a a method for resetting all of them at the same time.

gerth2 commented 8 years ago

off we go!

gerth2 commented 8 years ago

mostly implemented, appears functional!