Inline Callbacks
This update adds support for inline callbacks. These are really useful for streamlining dashboard integration. See the usage examples below:
Robot.kt
...
class Robot : TimedRobot(0.005) {
...
fun robotPeriodic() {
Dashboard.update()
...
}
...
fun teleopPeriodic() {
...
Dashboard.runIfUpdate("SOME_VARIABLE") {
key: String, value: Any? ->
println("$key : $value")
}
...
}
...
}
Even though the function runIfUpdate
is being called periodically, the lambda only gets called whenever SOME_VARIABLE
is updated on the dashboard web page. This functionality only works if the Dashboard.update()
function is called inside the robotPeriodic
function.