ColorProfile
Describes a target color and the per-channel tolerances used to decide whether a sensor reading is a match.
Use NextColorDistanceSensor.debug in telemetry to read live HSV values and calibrate color and tolerance. ColorSpace.HSV is recommended for most cases as it is more stable under changing lighting conditions.
Example:
val green = ColorProfile(
space = ColorSpace.HSV,
color = NextColor.HSV(130f, 0.7f, 0.6f),
tolerance = NextColor.HSV(20f, 0.3f, 1f),
)
override fun periodic() {
sensor.update()
if (sensor.isColor(green)) { ... }
}Content copied to clipboard
Author
28shettr