From ee6076a14b7e13d05d4a594b770ee90f9215e3c3 Mon Sep 17 00:00:00 2001 From: doinkythederp Date: Tue, 3 Dec 2024 18:02:41 -0800 Subject: [PATCH] feat: working limelight colorClass --- build.gradle.kts | 3 +++ .../frc2024/subsystems/indexer/IndexerIO.kt | 14 ++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index ce652e2..66b3c0d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -68,12 +68,15 @@ deploy { // or from command line. If not found an exception will be thrown. team = frc.getTeamOrDefault(3636) debug = frc.getDebugOrDefault(false) + + } roborio.artifacts { register("frcJava") { jvmArgs.add("-ea") // Remove this flag during comp to disable asserts setJarTask(tasks.jar) + dependsOn(tasks.assemble) } register("frcStaticFileDeploy") { diff --git a/src/main/kotlin/com/frcteam3636/frc2024/subsystems/indexer/IndexerIO.kt b/src/main/kotlin/com/frcteam3636/frc2024/subsystems/indexer/IndexerIO.kt index f5c2f2d..21ef8a4 100644 --- a/src/main/kotlin/com/frcteam3636/frc2024/subsystems/indexer/IndexerIO.kt +++ b/src/main/kotlin/com/frcteam3636/frc2024/subsystems/indexer/IndexerIO.kt @@ -52,12 +52,14 @@ class IndexerIOReal : IndexerIO{ inputs.indexerCurrent = Amps.of(indexerMotor.outputCurrent) inputs.position = Rotations.of(indexerMotor.encoder.position) - when (val colorClass = LimelightHelpers.getClassifierClass("limelight-sensor")) { - RED_CLASS -> inputs.balloonState = BalloonState.Red - BLUE_CLASS -> inputs.balloonState = BalloonState.Blue - NONE_CLASS -> inputs.balloonState = BalloonState.None - else -> throw AssertionError("Unknown balloon class: $colorClass") - } + val colorClass = LimelightHelpers.getClassifierClass("limelight") + inputs.balloonState = if (colorClass.contains(RED_CLASS)) { // "0 red" + BalloonState.Red + } else if (colorClass.contains(BLUE_CLASS)) { // "1 blue" + BalloonState.Blue + } else { // "" + BalloonState.None + } } override fun setSpinSpeed(speed: Double) {