How to Use vision.largestObject.angle()

Step 1: Add Vision1.largestObject.angle() to VCS

  • Add the code pictured above inside the curly brackets of int main().

Step 2: Configure the Vision Sensor in VCS

Step 3: Configure Another Color Signature

  • Repeat steps 4-8 to record another color signature. Make sure to click the set button for signature two, SIG_2.  When complete, the objects will be labeled SIG_1 and SIG_2 appropriately.

Step 4: Create a Code for the Vision Sensor

  • Click on the Codes tab, and in the first gray box name the code “CODE_1”. In the white box to the right type in “1,2” the numbers of the set signatures. The Vision utility will autocomplete to SIG_1,SIG_2.
  • If the Vision utility does not autocomplete, just type “SIG_1,SIG_2” into the white box.
  • Notice that the Vision sensor and utility is now tracking the pair as “Sig 12”.
  • The angle is calculated when a group of signatures is coded and tracked together.
  • When the signatured objects are rotated clockwise the angle will decrease negatively, and when rotated counterclockwise the angle will increase positively.

Step 5: Move to the Zero Angle Position

  • Move the SIG_1 object to the left of SIG_2 right in a horizontal position. This will place the “Sig 12” objects at the zero angle position.
  • Switch the position of the objects. This will place “Sig 12” objects in the negative 180 degree angle position.  
  • With the live feed from the Vision Sensor active, try rotating the pair to increase and decrease the angle.

Step 6: Move to the Positive 90 Degree Angle Position

  • Place the SIG_1 object below the SIG_2 in a vertical position. This will place “Sig 12” objects at the positive 90 degree angle position.  
  • With the live feed from the Vision Sensor active, try rotating the pair to increase and decrease the angle.

Step 7: Move to the Negative 90 Degree Angle Position

  • Move the SIG_1 object above SIG_2 in a vertical position. This will place “Sig 12” objects at the negative 90 degree angle position.  
  • With the live feed from the Vision Sensor active, try rotating the pair to increase and decrease the angle.