ColorMatch

class rev.ColorMatch

Bases: pybind11_object

REV Robotics Color Sensor V3.

This class allows access to a REV Robotics color sensor V3 on an I2C bus.

addColorMatch(color: wpilib._wpilib.Color) None

Add color to match object

Parameters:

color – color to add to matching

matchClosestColor(colorToMatch: wpilib._wpilib.Color) tuple[wpilib._wpilib.Color, float]

MatchColor uses euclidean distance to compare a given normalized RGB vector against stored values

Parameters:
  • colorToMatch – color to compare against stored colors

  • confidence – The confidence value for this match, this is simply 1 - euclidean distance of the two color vectors

Returns:

Closest matching color

matchColor(*args, **kwargs)

Overloaded function.

  1. matchColor(self: rev._rev.ColorMatch, colorToMatch: wpilib._wpilib.Color) -> Optional[wpilib._wpilib.Color]

MatchColor uses euclidean distance to compare a given normalized RGB vector against stored values

Parameters:

colorToMatch – color to compare against stored colors

Returns:

Matched color if detected

  1. matchColor(self: rev._rev.ColorMatch, colorToMatch: wpilib._wpilib.Color) -> tuple[Optional[wpilib._wpilib.Color], float]

MatchColor uses euclidean distance to compare a given normalized RGB vector against stored values

Parameters:
  • colorToMatch – color to compare against stored colors

  • confidence – The confidence value for this match, this is simply 1 - euclidean distance of the two color vectors

Returns:

Matched color if detected

setConfidenceThreshold(confidence: float) None

Set the confidence interval for determining color. Defaults to 0.95

Parameters:

confidence – A value between 0 and 1