How to Interpret vision.objects[ ]

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.