DualTelemetry

class DualTelemetry @JvmOverloads constructor(opMode: OpMode, movingAverageTimer: MovingAverageTimer? = null, overheadTag: String? = null, infoString: String? = null) : Telemetry

Telemetry implementation for BunyipsLib, integrating FtcDashboard and Driver Station calls in one object, while providing additional features useful for debugging and telemetry management. This is used internally by BunyipsOpMode to be accessible by the overridden telemetry field.

Author

Lucas Bubner, 2024

Since

1.0.0-pre

Constructors

Link copied to clipboard
constructor(opMode: OpMode, movingAverageTimer: MovingAverageTimer? = null, overheadTag: String? = null, infoString: String? = null)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
class HtmlItem(value: String, retained: Boolean, val isOverflow: Boolean, dashboardRef: Reference<String>, opMode: OpMode) : Telemetry.Item

Wraps a telemetry item displayed on the DS/FtcDashboard. Uses HTML to alter the way text is displayed based on wrapper utilities.

Properties

Link copied to clipboard

The caption value separator used for automatic splitting of the caption and value for FtcDashboard parsing. This value is also used when calling the aliased but legacy addData method (preferred to use add).

Link copied to clipboard

The color of the brackets in log messages, useful for distinguishing between different timer phases.

Link copied to clipboard

The time threshold at which the frequency segment will display yellow in the overhead telemetry to alert the user of slow looping times. Note that after RoadRunner.DRIVE_UPDATE_SAFETY_TIMEOUT, the loop timer will display red regardless.

Link copied to clipboard

A string to display the current 'status' of the OpMode, used for overhead telemetry.

Link copied to clipboard

Additional information to display in the overhead telemetry message, as the line under the OpMode name above the timing and controller statistics. By default, this is an empty string.

Link copied to clipboard

A string that overrules the status message in the overhead telemetry, such as a warning or error message. Set to null to use the default status message.

Functions

Link copied to clipboard
fun add(format: Any, vararg args: Any?): DualTelemetry.HtmlItem

Add data to the telemetry object for the Driver Station and FtcDashboard, with integrated formatting. Note that using a separator element (defined by dashboardCaptionValueAutoSeparator, default ": ") in your formatted string will split this to an item for FtcDashboard automagically, replicating what addDashboard would do.

Link copied to clipboard
open override fun addAction(action: Runnable): Any

Add an action to perform before Driver Station telemetry is updated.

Link copied to clipboard
fun addDashboard(key: String, value: Any?)

Add any additional telemetry to the FtcDashboard telemetry packet.

Link copied to clipboard
open override fun addData(caption: String, value: Any?): Telemetry.Item
open override fun addData(caption: String, format: String, vararg args: Any?): Telemetry.Item

Add data to the telemetry object for the Driver Station and FtcDashboard, with integrated formatting. This is an alias for add, with downcasting to a normal telemetry item. This will be automagically formatted for FtcDashboard.

open override fun <T : Any> addData(caption: String, valueProducer: Func<T>): Telemetry.Item
open override fun <T : Any> addData(caption: String, format: String, valueProducer: Func<T>): Telemetry.Item
Link copied to clipboard
fun addDS(format: Any, vararg args: Any?): Telemetry.Item

Add any additional telemetry to the Driver Station telemetry object.

Link copied to clipboard
open override fun addLine(): Telemetry.Line?
open override fun addLine(lineCaption: String): Telemetry.Line?
Link copied to clipboard

Add a new line to the telemetry object. This is an alias for add(""), to signify that a new line is intended.

Link copied to clipboard
fun addRetained(format: Any, vararg args: Any?): DualTelemetry.HtmlItem

Add a data to the telemetry object for the Driver Station and FtcDashboard, with integrated formatting.

Link copied to clipboard
open override fun clear()

Clear telemetry on the Driver Station, not including retention

Link copied to clipboard
open override fun clearAll()

Reset telemetry data, including retention and FtcDashboard

Link copied to clipboard
fun dashboardFieldOverlay(): Canvas

Add any field overlay data to the FtcDashboard telemetry packet.

Link copied to clipboard
open override fun getCaptionValueSeparator(): String

Get the current caption value separator.

Link copied to clipboard
open override fun getItemSeparator(): String
Link copied to clipboard
open override fun getMsTransmissionInterval(): Int

Get the current transmission interval for the Driver Station. FtcDashboard interval can be checked with FtcDashboard.getInstance().getTelemetryTransmissionInterval().

Link copied to clipboard
open override fun isAutoClear(): Boolean

Whether the telemetry object is set to auto-clear after each update for the Driver Station. FtcDashboard will always be false.

Link copied to clipboard
open override fun log(): Telemetry.Log

fun log(format: Any, vararg args: Any?)
fun log(obj: Class<*>, format: Any, vararg args: Any?)

Log a message to the telemetry log, with integrated formatting.

fun log(stck: StackTraceElement, format: Any, vararg args: Any?)

Log a message into the telemetry log

Link copied to clipboard
fun remove(vararg items: Telemetry.Item): Boolean
fun remove(items: List<Telemetry.Item>): Boolean

Remove entries from the Driver Station telemetry object.

Link copied to clipboard
open override fun removeAction(token: Any): Boolean

Remove an action from the telemetry object.

Link copied to clipboard
open override fun removeItem(item: Telemetry.Item): Boolean

Remove a data item from the telemetry object, which will remove only from the Driver Station. This is an alias for remove.

Link copied to clipboard
open override fun removeLine(line: Telemetry.Line): Boolean
Link copied to clipboard
open override fun setAutoClear(autoClear: Boolean)

Set the telemetry object to auto-clear after each update for the Driver Station.

Link copied to clipboard
open override fun setCaptionValueSeparator(dashboardCaptionValueAutoSeparator: String)

Set the current caption value separator.

Link copied to clipboard
open override fun setDisplayFormat(displayFormat: Telemetry.DisplayFormat)

Set the current display format for the Driver Station. By default this is already set to HTML formatting, and it is recommended to leave this as-is.

Link copied to clipboard
open override fun setItemSeparator(itemSeparator: String)
Link copied to clipboard
fun setLogCapacity(capacity: Int)

The maximum number of telemetry logs that can be stored in the telemetry log. If the number of logs exceeds this limit, the oldest logs will be removed to make space for new logs to avoid crashing the Driver Station.

Link copied to clipboard
open override fun setMsTransmissionInterval(msTransmissionInterval: Int)

Set the transmission interval in milliseconds for the Driver Station and FtcDashboard.

Link copied to clipboard
open override fun speak(text: String)

Speak a message to the Driver Station.

open override fun speak(text: String, languageCode: String, countryCode: String)

Speak a message to the Driver Station with language and country code.

Link copied to clipboard
open override fun update(): Boolean

Update and push queued telemetry to the Driver Station and FtcDashboard.

Inherited functions

Link copied to clipboard
open fun setNumDecimalPlaces(p0: Int, p1: Int)