-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Priority Level: Low
Refactor the telemetry system to pass objects directly instead of manually defining individual telemetry fields. See current implementation example:
MissionDecodeTheFinalCodePartOne2025-2026/TeamCode/src/main/kotlin/pioneer/opmodes/teleop/Teleop.kt
Lines 34 to 43 in 4de6057
| private fun addTelemetryData() { | |
| telemetry.addData("Drive Power", driver1.drivePower) | |
| telemetry.addData("Flywheel TPS", bot.flywheel?.velocity) | |
| telemetry.addData("Flywheel Speed", driver2.flywheelSpeed) | |
| telemetry.addData("Field Centric", driver1.fieldCentric) | |
| telemetry.addData("Pose", bot.pinpoint!!.pose) | |
| telemetry.addData("Velocity", "vx: %.2f, vy: %.2f".format(bot.pinpoint?.pose?.vx, bot.pinpoint?.pose?.vy)) | |
| telemetry.addData("Voltage", bot.batteryMonitor?.voltage) | |
| telemetry.addData("Flywheel Motor Current", bot.flywheel?.motor?.getCurrent(CurrentUnit.MILLIAMPS)) | |
| } |
Each hardware or subsystem class will implement a structured toString() method, similar to the example below:
Example implementation:
Lines 72 to 85 in 4de6057
| override fun toString(): String { | |
| val (r, g, b) = normalizedRGBA | |
| val (h, s, v) = normalizedHSV | |
| val d = distance | |
| return "R: %.1f G: %.1f B: %.1f H: %.1f S: %.1f V: %.1f D: %.1f cm".format( | |
| r, | |
| g, | |
| b, | |
| h, | |
| s, | |
| v, | |
| d | |
| ) | |
| } |
Proposed usage:
val telemetryArgs = mutableListOf<Any>(Object1, Object2, Object3)Telemetry addition:
fun addLines(objs: List<Any?>) {
for (obj in objs) {
if (obj != null) { // check against nulled hardware objects
phone.addLine(obj::class.simpleName, obj.toString())
// plus other code as needed
}
}
}
Running:
telemetry.addLines(telemetryArgs)
telemetry.update()Appending new objects later:
telemetryArgs += ObjNGoal is to simplify telemetry definitions in opmodes. This can be placed in bot (ideally) or OpMode.
Metadata
Metadata
Assignees
Labels
No labels