strongback / strongback-java

A library for FIRST Robotics Competition robots that makes it easier to write and test your robot code.
MIT License
41 stars 38 forks source link

Issue 84 - Simplify engine and executor #85

Closed rhauch closed 7 years ago

rhauch commented 7 years ago

This change does not remove or change any public API methods, and therefore no robot code needs to be changed. However, a few of the Strongback configuration options available in previous versions are no longer supported, so the corresponding methods in Strongback and its configurator are now deprecated and may no longer have any affect.

This PR corrects a number of errors and simplifies the engine by rewrites how the Strongback.java class is implemented. All of the existing public methods are still available, though quite a few have been deprecated and now may no longer do anything. For example, the different timer modes and clocks only complicated how to configure Strongback, yet really didn’t offer any advantages and may have made the code worse by making the execution period less consistent. In short, robot code can continue to use these deprecated methods, but the methods may have no effect and could be removed from the robot’s codebase. Note that the deprecated methods will be removed in the next major release of Strongback for 2017.

This change also corrects and simplifies how the executor thread operates. Now, Strongback measures the time required to run all executables (e.g., the switch reactor, command scheduler, data recorder, event recorder, etc.), and uses this time to determine if the executor did not complete in the specified amount of time. This should improve the accuracy of the error messages about taking too long to execute each cycle. And Strongback only uses the “busy” timer mode and the system clock, which simplified the executor implementation.

Finally, Strongback now supports priorities for its executables:

Currently, the command scheduler (through with all commands are run) will operate at HIGH priority, while the data recorder (if used) and the switch reactor will operate at the MEDIUM priority. The event recorder still records the time at which events occurred, but events are written out at LOW priority.

Fixes #84.