Vision Sensor#
Introduction#
The Vision Sensor is a camera-based sensor that can detect and track Color Signatures and Color Codes. It allows a robot to analyze its surroundings and respond to visual input.
The Vision examples have a Vision Sensor configured with the name Vision1, which appears in the Blocks.
Below is a list of available blocks:
Actions – Capture data from the AI Vision Sensor for a selected object type.
take vision snapshot – Captures a snapshot using a selected Vision Sensor and signature.
Settings – Choose which object to interact with.
set vision object item – Specifies which detected object (by order) to reference in object-related Blocks.
Values – Access and use the captured data.
vision object exists? – Returns a Boolean indicating whether a detected object is present.
vision object count – Returns the number of detected objects in the snapshot.
vision object property – Returns details such as:
Actions#
take vision snapshot#
The take vision snapshot block will capture the current image from the Vision Sensor to be processed and analyzed for color signatures or color codes.
Colors signatures and color codes must be configured first in the Vision Sensor Utility before they can be used with this block.
Note: A snapshot is required first before using any other Vision Sensor blocks.
The dataset stores objects ordered from largest to smallest by width, starting at index 0. Each object’s properties can be accessed using vision object property block. An empty dataset is returned if no matching objects are detected.
take a [Vision1 v] snapshot of [SELECT_A_SIG v]
Parameter |
Description |
---|---|
vision sensor |
The Vision Sensor to use, configured in the Devices window. |
signature |
Filters the dataset to only include data of the specified color signature or color code. |
Example
Example coming soon.
Settings#
set vision object index#
The set vision object index block sets which item in the dataset to use.
set [Vision1 v] object index to [1]
Parameter |
Description |
---|---|
vision sensor |
The Vision Sensor to use, configured in the Devices window. |
index |
The number of the item in the dataset to use. |
Example
Example coming soon.
Values#
vision object exists?#
The vision object exists? block returns a Boolean indicating whether a specified color signature or color code is detected in the dataset.
True – The dataset includes the color signature or color code.
False – The dataset does not include the color signature or color code.
<[Vision1 v] object exists?>
Parameters |
Description |
---|---|
vision sensor |
The Vision Sensor to use, configured in the Devices window. |
Example
Example coming soon.
vision object count#
The vision object count block returns the number of detected objects in the dataset as an integer.
([Vision1 v] object count)
Parameters |
Description |
---|---|
vision sensor |
The Vision Sensor to use, configured in the Devices window. |
Example
Example coming soon.
vision object property#
There are nine properties that are included with each object (shown below) stored after the take vision snapshot block is used.
([Vision1 v] object [width v])
Some property values are based off of the detected color signature’s or color code’s position in the Vision Sensor’s view at the time that the take vision snapshot block was used. The Vision Sensor has a resolution of 316 by 212 pixels.
Parameter |
Description |
---|---|
vision sensor |
The Vision Sensor to use, configured in the Devices window. |
property |
Which property of the detected object to use: |
width#
width returns the width of the detected color signature in pixels as an integer from 0 to 316.
[Vision1 v] object [width v]
Example
Example coming soon.
height#
height returns the height of the detected color signature in pixels as an integer from 0 to 212.
[Vision1 v] object [height v]
Example
Example coming soon.
centerX#
centerX returns the x-coordinate of the center of the detected color signature in pixels as an integer from 0 to 316.
[Vision1 v] object [centerX v]
Example
Example coming soon.
centerY#
centerY returns the y-coordinate of the center of the detected objcolor signature in pixels as an integer from 0 to 212.
[Vision1 v] object [centerY v]
Example
Example coming soon.
angle#
angle returns the orientation of the detected color code as an integer in degrees from 0 to 180.
[Vision1 v] object [angle v]
Example
Example coming soon.