Skip to content
This repository has been archived by the owner on May 5, 2020. It is now read-only.

Intervals

addonovan edited this page Jun 29, 2016 · 1 revision

Intervals

An interval is simply a class that represents a period of time, and is "active" only during that duration. This is useful for timing functions, as it's more concise and readable than doing the comparisons by hand.

Both Intervals' constructors have two parameters:

  1. time from now that this interval begins (in the correct unit)
  2. duration of the interval (in the correct unit)

Interval

Interval is a class that isn't especially high resolution nor accurate. This deals with milliseconds and uses the System.currentTimeMillis() method to tell the time, which has been criticized for not being incredibly accurate. To combat this inaccuracy, the interval remains active not only in between the start and end times, but also within 5 milliseconds before or after.

HQInterval

A High Quality Interval is a class that is especially high resolution and accurate. This deals in nanoseconds and uses the much more accurate System.nanoTime() method to tell the time. A drawback to using this class is that its constructor deals in nanoseconds, which might lead to some errors.

  1. Intro & Installation
  2. OpModes
    1. [Lifecycle](OpMode Lifecycle)
    2. [Profiles & Configuration](Profiles & Configuration)
    3. Types
      1. OpMode
      2. LinearOpMode
  3. Hardware
    1. [Access](Hardware Access)
    2. Extension Framework
      1. [Advanced Hardware](Advanced Hardware)
      2. [Custom Hardware Extensions](Custom Hardware Extensions)
  4. Utils
    1. Intervals
    2. [Motor Assembly](Motor Assembly)
  5. [Task Management](Task Management)
Clone this wiki locally