Overview
Core is a union of Dairy’s Core runtime extensions and a number of utilities that depend upon it, or the android platform.
Dairy’s Core is the backbone of many add-on libraries. It enables many new patterns when writing FTC code, and Core is useful both for end users, who want to apply these patterns and utilities to improve their FTC code, and for authors of libraries, for whom Core provides a toolbox and base against which its easy to write powerful FTC libraries, that automatically play nice with the rest of the Dairy platform, and impose minimal further impact on teams.
Once Core is installed, you must not use sleep
or similar blocking code
(like while loops) to structure LinearOpMode
autonomous code. Instead, write
‘asynchronous polled’ friendly code. This style of code take the form of update
functions that get run (polled) every loop, and does not block the loop
(asynchronous). This must not be done in OpMode
either, but this is much
harder to do in OpMode
. Feature
s rely on the hooks running, and you lose
many of the benefits of Dairy, or may cause undefined / unexpected behaviour
Features:
Feature
s are components that have hooks into the OpMode runtime.- The
Dependency
system allowsFeature
s to declare the conditions that need to be met for them to be attached to an OpMode, whether this is an annotation or anotherFeature
. Controller
s have support for systems like PID controllers, or MotionProfiles, that update in the background of your OpMode.OpModeLazyCell
allows you to separate out your hardware access into several functions.- OpMode templating via
OpModeLazyCell
and the enhanced Dairy runtime, an improved alternative to aRobotHardware
class. EnhancedDoubleSupplier
s andEnhancedBooleanSupplier
s that rely on the Dairy runtime to automatically provide additional utilities.- A unit test runtime currently suitable for testing libraries that use Dairy, hopefully later suitable for testing user code.
Installation:
Core bundles a copy of Util and Sinister along with itself, however, those libraries may have newer updates than the current version of Core, so check if you need to install them separately.
Currently Util is ahead of Core, you must install it separately.
- Repository
This only needs to be done once, if you already have this, no need to add it again.
Add
To TeamCode
’s build.gradle
, above dependencies
.
- Implementation
Add the newest version of Core found
here to
the dependencies
block:
The repo will give you the line to add.
- Sync
Run a gradle sync.