Field View

It provides a dynamic and interactive visualization of the game field, allowing teams to monitor their robot's position, orientation, and interactions with game elements in real-time. This feature is particularly useful for debugging autonomous flows, tracking robot movements.

It works live a canvas, so it can be used for any drawing application.

Supported Objects

  1. Line
  2. Circle
  3. Rectangle

more will be added soon

Gotchas

  1. Objects are drawn in the order they are sent to the debug function, and their layering (z-index) is automatically managed by the system.
  2. The input order is flexible, you can provide Drawable objects and text lines in any order within the debug function.
  3. Every Drawable object requires a look to define its visual appearance. The look specifies styling attributes such as fillColor, outlineColor, outlineWidth.

Example OpMode File: TestOpMode.kt

Below is an example of how field telemetry can be implemented in an OpMode:

package org.firstinspires.ftc.teamcode.examples.field

import com.bylazar.ftcontrol.panels.Panels
import com.bylazar.ftcontrol.panels.json.Circle
import com.bylazar.ftcontrol.panels.json.Line
import com.bylazar.ftcontrol.panels.json.Look
import com.bylazar.ftcontrol.panels.json.Point
import com.bylazar.ftcontrol.panels.json.Rectangle
import com.qualcomm.robotcore.eventloop.opmode.OpMode
import com.qualcomm.robotcore.eventloop.opmode.TeleOp
import kotlin.random.Random

@TeleOp(name = "Field Test OpMode")
class TestOpMode : OpMode() {
    var panelsTelemetry = Panels.getTelemetry()

    override fun init() {
        panelsTelemetry.debug("Init was ran!")
        panelsTelemetry.update(telemetry)
    }

    override fun loop() {
        panelsTelemetry.debug("Loop ${System.currentTimeMillis()} ran!")
        panelsTelemetry.debug(
            Line(
                Point(0.0, 0.0),
                Point(0.0, Random.nextDouble(0.0, 10.0)),
            ).withLook(
                Look(
                    outlineColor = "red",
                    outlineWidth = 1.0,
                    fillColor = "",
                    opacity = 1.0
                )
            ),
            Circle(
                Point(20.0, 20.0),
                Random.nextDouble(0.0, 10.0),
            ).withLook(
                Look(
                    outlineColor = "blue",
                    outlineWidth = 1.0,
                    fillColor = "yellow",
                    opacity = 1.0
                )
            ),
            Rectangle(
                Point(40.0, 40.0),
                Random.nextDouble(0.0, 10.0),
                Random.nextDouble(0.0, 10.0),
            ).withLook(
                Look(
                    outlineColor = "green",
                    outlineWidth = 1.0,
                    fillColor = "",
                    opacity = 1.0
                )
            )
        )
        panelsTelemetry.update(telemetry)
    }
}
kt

A library by Lazar from 19234 ByteForce.