Class RGBDigoutConfig

java.lang.Object
com.reduxrobotics.sensors.canandcolor.DigoutConfig
com.reduxrobotics.sensors.canandcolor.RGBDigoutConfig

public final class RGBDigoutConfig extends DigoutConfig
A digital output configuration that uses RGB thresholds.

Basic usage example:

 Canandcolor color = new Canandcolor(0);
 // Check if the an object is close and the color sensor is seeing red for at least 10 milliseconds,
 color.digout1().configureSlots(new RGBDigoutConfig()
   .setMaxProximity(0.25)
   .setProximityInRangeFor(0.01)
   .setMinRed(0.1)
   .setColorInRangeFor(0.01)
 );
 // Instantly send CAN digout frames when the above condition changes at all.
 color.digout1().configureFrameTrigger(DigoutFrameTrigger.kRisingAndFalling);
 // Configure the DIG-1 GPIO pin to also output the condition
 color.digout1().configureOutputPin(DigoutPinConfig.kDigoutLogicActiveHigh);
 // Check value over CAN
 color.digout1().getValue();
 
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    setColorInRangeFor(double seconds)
    Sets the minimum time that the color readings have to match the upper and lower RGB thresholds in order for the digout channel to be true.
    setMaxBlue(double thresh)
    Sets the value that the blue color reading has to be greater than or equal to for the digout channel to be true.
    setMaxGreen(double thresh)
    Sets the value that the green color reading has to be greater than or equal to for the digout channel to be true.
    setMaxProximity(double thresh)
    Sets the value that the proximity reading has to be less than or equal to for the digout channel to be true.
    setMaxRed(double thresh)
    Sets the value that the red color reading has to be greater than or equal to for the digout channel to be true.
    setMinBlue(double thresh)
    Sets the value that the blue color reading has to be greater than or equal to for the digout channel to be true.
    setMinGreen(double thresh)
    Sets the value that the green color reading has to be greater than or equal to for the digout channel to be true.
    setMinProximity(double thresh)
    Sets the value that the proximity reading has to be greater than or equal to for the digout channel to be true.
    setMinRed(double thresh)
    Sets the value that the red color reading has to be greater than or equal to for the digout channel to be true.
    setProximityInRangeFor(double seconds)
    Sets the minimum time that the proximity reading has to match the upper and lower thresholds in order for the digout channel to be true.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RGBDigoutConfig

      public RGBDigoutConfig()
      Default constructor.
  • Method Details

    • setMinProximity

      public RGBDigoutConfig setMinProximity(double thresh)
      Sets the value that the proximity reading has to be greater than or equal to for the digout channel to be true.

      If not specified, this value is 0.0

      Parameters:
      thresh - proximity threshold
      Returns:
      calling object
    • setMaxProximity

      public RGBDigoutConfig setMaxProximity(double thresh)
      Sets the value that the proximity reading has to be less than or equal to for the digout channel to be true.

      If not specified, this value is 1.0

      Parameters:
      thresh - proximity threshold
      Returns:
      calling object
    • setProximityInRangeFor

      public RGBDigoutConfig setProximityInRangeFor(double seconds)
      Sets the minimum time that the proximity reading has to match the upper and lower thresholds in order for the digout channel to be true.

      This can be used to "debounce" readings by requiring the proximity to match the thresholds for multiple readings.

      This threshold has millisecond resolution, but the units are still seconds.

      Parameters:
      seconds - The minimum number of seconds. The default value is 0 (zero time required)
      Returns:
      calling object
    • setMinRed

      public RGBDigoutConfig setMinRed(double thresh)
      Sets the value that the red color reading has to be greater than or equal to for the digout channel to be true.

      If not specified, this value is 0.0

      Parameters:
      thresh - color value threshold
      Returns:
      calling object
    • setMaxRed

      public RGBDigoutConfig setMaxRed(double thresh)
      Sets the value that the red color reading has to be greater than or equal to for the digout channel to be true.

      If not specified, this value is 1.0

      Parameters:
      thresh - color value threshold
      Returns:
      calling object
    • setMinGreen

      public RGBDigoutConfig setMinGreen(double thresh)
      Sets the value that the green color reading has to be greater than or equal to for the digout channel to be true.

      If not specified, this value is 0.0

      Parameters:
      thresh - color value threshold
      Returns:
      calling object
    • setMaxGreen

      public RGBDigoutConfig setMaxGreen(double thresh)
      Sets the value that the green color reading has to be greater than or equal to for the digout channel to be true.

      If not specified, this value is 1.0

      Parameters:
      thresh - color value threshold
      Returns:
      calling object
    • setMinBlue

      public RGBDigoutConfig setMinBlue(double thresh)
      Sets the value that the blue color reading has to be greater than or equal to for the digout channel to be true.

      If not specified, this value is 0.0

      Parameters:
      thresh - color value threshold
      Returns:
      calling object
    • setMaxBlue

      public RGBDigoutConfig setMaxBlue(double thresh)
      Sets the value that the blue color reading has to be greater than or equal to for the digout channel to be true.

      If not specified, this value is 1.0

      Parameters:
      thresh - color value threshold
      Returns:
      calling object
    • setColorInRangeFor

      public RGBDigoutConfig setColorInRangeFor(double seconds)
      Sets the minimum time that the color readings have to match the upper and lower RGB thresholds in order for the digout channel to be true.

      This can be used to "debounce" readings by requiring the color to match the thresholds for multiple readings.

      This threshold has millisecond resolution, but the units are still seconds.

      Parameters:
      seconds - The minimum number of seconds. The default value is 0 (zero time required)
      Returns:
      calling object