How to Interpret vision.objects[ ]

Get more with VEXcode
We recommend you transition to our new software. VEXcode has both block-based and text-based options, that work on Chromebooks, iPads, Android tablets, Windows and Macs. Visit code.vex.com for more details on how to download VEXcode.
VEX Coding studio has been discontinued and is no longer available for download. Already downloaded? The program will continue to function but will no longer be supported.
Users who transition to VEXcode can migrate their C++/C++ Pro projects to VEXcode Text by following this article.

Step 1: Configure the Vision Sensor

Step 2: Connect to the V5 Robot Brain

  • Disconnect the Micro USB from the Vision Sensor.
  • Connect the Vision Sensor to the port on the V5 Robot Brain that it was assigned to in VCS.

Step 3: Ensure vision.takeSnapshot() precedes vision.objects[ ]

  • The Vision.takeSnapshot() command tells the vision sensor to capture and save all of the detected objects information into the Vision.objects[] array.

Step 4: Vision.objects[ ]

  • Using a Vision.objects[] command will access the different values related to the color signature objects found and stored in an array after using the Vision.takeSnapshot() command. The color signatures stored in the array are ordered from the largest sized objects to the smallest.

NOTE: In order to use the Vision.objects[] command correctly, an array index number must be between the brackets [].

Vision.objects[ ].originX and Vision.objects[ ].originY

  •  Vision.objects[].originX returns the object specified in the square brackets' origin X-axis value. Similarly the Vision.objects[].originY returns the specified object's origin Y-axis value.

Vision.objects[ ].centerX and Vision.objects[ ].centerY

  •  Vision.objects[].centerX  returns the center of the specified object's center X-axis position and Vision.objects[].centerY returns the center of the specified object's center Y-axis position.

Vision.objects[ ].width and Vision.objects[ ].height

  •  Vision.objects[].width returns the width of the specified object and Vision.objects[].height returns the height of the specified object.

Vision.objects[ ].angle

  •  Vision.objects[].angle returns the angle of the specified object in the square brackets.

NOTE:  Vision.objects[].angle is only valid for color codes. Normal color signatures will always have an angle value of 0.