Utilities Everywhere
CoreControl provides a collection of utility classes and functions designed to simplify common FTC programming tasks. This includes global access to SDK objects like Telemetry and HardwareMap, as well as mathematical helpers and debugging tools.
Global Objects
Section titled “Global Objects”CoreControl automatically injects common SDK objects into global variables when an OpMode starts. This allows you to access them from anywhere in your code—inside Modules, Commands, or utility classes—without passing them around as parameters.
HardwareMap
Section titled “HardwareMap”Use hardwareMapEverywhere to initialize your hardware in your modules without passing the hardwareMap object around.
object Intake : Module() { private lateinit var motor: DcMotor
override fun onInit() { // Access hardwareMap globally motor = hardwareMapEverywhere.get(DcMotor::class.java, "intake") }}public class Intake extends Module { private DcMotor motor;
@Override public void onInit() { // Access hardwareMap globally motor = GlobalObjects.hardwareMapEverywhere.get(DcMotor.class, "intake"); }}Telemetry
Section titled “Telemetry”Use telemetryEverywhere to send data to the Driver Station from anywhere in your code.
fun someFunction() { telemetryEverywhere.addData("Status", "Running") // Note: You generally don't need to call update() manually, // as the OpMode handles it.}public void someFunction() { GlobalObjects.telemetryEverywhere.addData("Status", "Running");}Access the current time (since the start of the OpMode) globally.
val currentTime = nowMs // Time in millisecondsval currentTimeSeconds = nowS // Time in secondsdouble currentTime = GlobalObjects.getNowMs();double currentTimeSeconds = GlobalObjects.getNowS();Helper Utilities
Section titled “Helper Utilities”CoreControl also provides some utility functions and classes to assist with common tasks.
Low Pass Filter
Section titled “Low Pass Filter”A simple implementation of a low-pass filter for smoothing sensor data. This is useful for reducing noise in sensor readings.
val filter = LowPassFilter(alpha = 0.5) // 0.0 to 1.0 (higher is smoother but more lag)val smoothedValue = filter.filterValue(sensorInput)LowPassFilter filter = new LowPassFilter(0.5);double smoothedValue = filter.filterValue(sensorInput);Global Sleep
Section titled “Global Sleep”A wrapper around Thread.sleep that also logs a message to telemetry. This is useful for debugging or simple delays where blocking the thread is acceptable (e.g., during initialization).
globalSleep(1000, "Waiting for sensor initialization")Utilities.globalSleep(1000, "Waiting for sensor initialization");