Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
feat: working limelight colorClass
Browse files Browse the repository at this point in the history
  • Loading branch information
doinkythederp committed Dec 4, 2024
1 parent 1a53e98 commit ee6076a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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<FRCJavaArtifact>("frcJava") {
jvmArgs.add("-ea") // Remove this flag during comp to disable asserts
setJarTask(tasks.jar)
dependsOn(tasks.assemble)
}

register<FileTreeArtifact>("frcStaticFileDeploy") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ee6076a

Please sign in to comment.