Class RGBDigoutConfig
java.lang.Object
com.reduxrobotics.sensors.canandcolor.DigoutConfig
com.reduxrobotics.sensors.canandcolor.RGBDigoutConfig
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();
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionsetColorInRangeFor
(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.
-
Constructor Details
-
RGBDigoutConfig
public RGBDigoutConfig()Default constructor.
-
-
Method Details
-
setMinProximity
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
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
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
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
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
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
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
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
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
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
-