Main Content

Vision Sensor

Represent connected V5 Vision Sensor and read coordinates of color blobs (objects)

Add-On Required: This feature requires the Simulink Coder Support Package for VEX EDR V5 Robot Brain add-on.

  • Vision Sensor block

Libraries:
Simulink Coder Support Package for VEX EDR V5 Robot Brain / Sensors

Description

The Vision Sensor block represents a V5 Vision Sensor connected to a specified port on a VEX® EDR V5 Robot Brain, and reads the coordinates of color blobs (objects) detected by the V5 Vision Sensor. The color blob to detect depends on the ID of the color signature that you select in this block.

To configure the color signatures, see Launch V5 Vision Utility.

Ports

Output

expand all

The number of objects (color blobs) that are detected by V5 Vision Sensor, based on the selected ID of Color signature. One Vision Sensor block can be used to detect up to 10 objects based on the selected ID.

Dependencies

This output depends on the value selected for the Maximum no. of objects parameter.

Data Types: double

The x coordinate of the color blob (object) based on the field of view, measured in pixels, as detected by V5 Vision Sensor. If multiple objects (say, n) are detected, this output is a 1-by-n array of values.

Data Types: double

The y coordinate of the color blob (object) based on the field of view, as detected by V5 Vision Sensor. If multiple objects (say, n) are detected, this output is a 1-by-n array of values.

Data Types: double

The width of the field of view of the color blob, as detected by V5 Vision Sensor. If multiple objects (say, n) are detected, this output is a 1-by-n array of values.

Data Types: double

The height of the field of view of the color blob, as detected by V5 Vision Sensor. If multiple objects (say, n) are detected, this output is a 1-by-n array of values.

Data Types: double

Parameters

expand all

Select the Smart Port on the VEX EDR V5 Robot Brain to which the V5 Vision Sensor is connected. There are 21 Smart Ports on the VEX EDR V5 Robot Brain that you can connect to V5 Vision Sensor.

Smart Port must be unique for each block in the model. If multiple Vision Sensor blocks with the same port are used, the last executed Vision Sensor block may only be active.

Select the ID of the color signature (which you configured using the VEX Vision Utility) to detect the object. The ID corresponds to the sequence of the color signature as it appears in the Vision Utility, irrespective of the name that you gave for a particular signature.

Select the maximum number of objects that the V5 Vision Sensor should try to detect based on the selected ID of Color signature.

Select this option to enable the display of objects (as detected by the V5 Vision Sensor) on the LCD screen of VEX V5 Robot Brain. The size of the color blobs displayed in the LCD screen corresponds to the distance of the objects from the V5 Vision Sensor.

Enter the time interval at which the block reads values from the V5 Vision Sensor.

When you set this parameter to -1, Simulink® determines the best sample time for the block based on the block context within the model.

Launch V5 Vision Utility

To configure a color signature that you specify in the Vision Sensor block, you need to use the VEX Vision Utility. Click Launch V5 Vision Utility in the block mask to launch Vision Utility.

For details about saving a color signature on V5 Vision Sensor using the VEX Vision Utility, see Train V5 Vision Sensor for Color Signature.

Visualize Detected Objects

To visualize the detected objects on VEX V5 robot brain, select Enable display on VEX V5 Brain on the Vision Sensor block.

A sample screen showing the object detected by Vision Sensor is shown below.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2019b