Software Design
Overview
Programming is designed in LabVIEW. The vision acquisition and image processing VI’s are deployed on the desktop, while the servo control VI’s are deployed on the myRIO microprocessor. The variables that are communicating to the myRIO from the desktop are the x and y motor output after the PID correction.
The desired ball position is user input and the user is able to choose from 4 modes:
1. Point to Point (input coordinates)
2. Circle Path (input radius and speed)
3. Figure 8 (input size, speed, and orientation)
4. Box Path (continuous corner to corner movement)
Image Processing
The following sequence are the steps implemented on LabVIEW Vision Assistant in order to collect the real time x and y coordinate position of the ball.
1. Original Image
2. Image Mask - Set Region of Interest (ROI)
3. Color Threshold (separate ball from red plate)
4. Fill holes (fill the ball)
5. Geometry (flip image 180 ̊)
6. Circle Detection (set min and max diameter)
The images below are the images corresponding to the sequence of image processing events (left to right). As seen by the last picture, the green square signifies the detection of the circle. The center coordinates of the circle are then outputted. The coordinate units used in the software design is pixels.
A problem that we would run into was that the circle detection block would detect 0 or 2 balls. To remedy this, we had to alter lighting, change the values of the minimum and maximum value of the diameter (step 6), and use a case structure to use the last known location value in the case of detecting 0 balls. Having the ROI not correctly placed also led to incorrect circle detection. Since the webcam is not always normal to the plate, the ROI had to be set to be smaller than the total size of the plate. When the sides of the aluminum squares entered the ROI image, the color threshold would detect the aluminum squares to also be the ball.
The image processing loop was occurring every 75 milliseconds. When we were running at a faster time than this, the board was more jittery because of the faster reaction rate. By slowing it down to 75 ms, plate angle control became much smoother.

