Overview
An extension of the LinearOpMode
class that adds a few extra utility features, namely:
A global
mTelemetry
, aTelemetry
object which logs to both the driver station and FTCDashboardA global
hwMap
(hardwareMap
, but shorter name)Broadcasts a message (
BlackOp.STARTING_MSG
) when the runOpMode method is called with Scheduler.emit- This in turn opens up support for
@CreateOnGo/@EvalOnGo
(createOnGo/evalOnGo
for Kotlin), a very nice utility feature
- This in turn opens up support for
More will come soon as I think of new, helpful utilities
Usage
It's just like using LinearOpMode
, just a couple minor differences:
- Java
- Kotlin
@TeleOp
public class MyOpMode extends BlackOp { // BlackOp instead of LinearOpMode
@CreateOnGo // Can use @CreateOnGo to automatically
private MyMotor myMotor; // create objects when go() is called
@Override
public void go() { // go() instead of runOpMode()
Scheduler.launchOnStart(this) {
mTelemetry().addData("Hello", "World!"); // Logs to both driver station and FTCDashboard
}
}
}
class Teast {
static {
Scheduler.on(BlackOp.STARTING_MSG, () -> {
// This will fire once when the op mode is started
// Also, you can globally access a hwMap and an mTelemetry
BlackOp.hwMap()
BlackOp.mTelemetry().addLine("Hi!")
});
}
}
@TeleOp
class MyOpMode : BlackOp() { // BlackOp instead of LinearOpMode
private val motor by evalOnGo(::MyMotor) // Can use evalOnGo()/createOnGo()
// or (either works)
private val motor by createOnGo<MyMotor>()
override fun go() { // go() instead of runOpMode()
Scheduler.launchOnStart(this) {
mTelemetry.addData("Hello", "World!") // Logs to both driver station and FTCDashboard
}
}
}
object Teast {
init {
Scheduler.on(BlackOp.STARTING_MSG) {
// This will fire once when the op mode is started
// Also, you can globally access a hwMap and an mTelemetry
BlackOp.hwMap
BlackOp.mTelemetry.addLine("Hi!")
}
}
}