V2020.1.56.3_ Contrast Sensor



Overview

The Contrast Sensor will match a detected color to its Base Color and its Background Color to give an output depending on which of the two colors matches more with the detected color.

A Contrast Sensor analysing three cubes for a Base color and a Background color. The Output Signal returns High for the red cube since it corresponds to the Base color, and low for the green and blue cubes since they correspond more to the Background color


Where to find

The Contrast Sensor Physical and Logic components can be found under Standard Components > Color Sensor > Contrast Sensor.

It can also be accessed from the GameObject menu or from the Hierarchy Context menu.

A new GameObject will be created if you do not have a GameObject selected. Otherwise, the Contrast Sensor will be added to the selected GameObject


Feature layout

Physical Component

Live Data

 

State

Shows whether the Contrast Sensor is currently active and thus whether it will detect a color

Output Signal

Shows whether or not the Contrast Sensor is currently detecting the Base Color or the Background Color

Match Percentage Base

The percentage by which the detected color matches the Base Color

Match Percentage Background

The percentage by which the detected color matches the Background Color

Properties

 

Color Sensor

The specific Color Sensor to use for the Contrast Sensor. By default, a
Color Sensor will automatically be assigned by either finding a suitable one in the scene or creating a new one

Base Color

The color with which the detected color will be matched with for a High output value

Background Color

The color with which the detected color will be matched with for a Low output value

On Signal High

A UnityEvent that is fired as soon as the Contrast Sensor has a High Output Signal

On Signal Low

A UnityEvent that is fired as soon as the Contrast Sensor has a Low Output Signal

Control Panel

 

Generate Control Panel for ContrastSensor

Click this button to generate a Control Panel for the Contrast Sensor


Logic Component

Properties

 

ContrastSensor

The Phyisical Contrast Sensor component attached to this Logic component

PLC I/O

In the PLC I/O panel you can see the latest input and output values from the PLC

PLC settings and Debugging

These settings are general Logic Component settings.


How to use

  1. Assign a Contrast Sensor physical component to a GameObject, or create a new one directly from the menu

  2. Select the desired settings under the Properties tab

  3. In Play Mode, the Match Percentages of detected objects will be displayed, as well as the Output Signal