Controlling motors using vision processing help

okay this is my first year programming in Labview. I have read everything I can find about vision processing but I cant find anything about using it to control motors. Can someone help us with this. Our team is trying to follow the rectangular targets using the camera and turret so our shooting mechanism is always aimed at the basket even when we are moving. It will be real helpful if you give me a sample code in labview or direct me to a website. And thank you in advance :).

The output of the rectangular target processing is between -1 and 1. You should be able to scale this a bit and build a proportional controller pretty easy. If you do nothing else, you can send the value to the motor, or perhaps the negative of the value.

Another important element is to select which target you are aiming at and keep it consistent.

Finally, you may find that the camera is not a very quick sensor. It is great for deciding how much to rotate, not so great to close a control loop with. You may find that using a pot or encoder may be even better way to go once you know how much to rotate.

Greg McKaskle

here is my post to the NI site

early in the season we were able to get the rectangular target processing example to see the target and give a distance from it, when we installed the leds.
We are now are wanting the camera to track the target using the servos to move the camera.
i can’t see anywhere in this example where that is implemented. is this another example or it there a way to get track distance and camera tracking from this example??

but i’m now glad i checked CD. so is it true there is no target tracking built into the example? we were considering giving the driver’s pots to track the target.

but i do not see where the ±1 output is? can you direct me into the block diagram more closely?

i think i found the ±1. is it in computer

target center (-1 to 1) gives an x and y?

The rectangular target processing produces a Target info array. Each element of that array is a bundle containing X,Y coordinates and computed distance of each recognized rectangle.

got it, we have been using the distance, but not the x, y coordinates,

thank u

There is a camera servo example that does a search pattern, moves the camera to point at a colored object, and has a small state machine for overshoot and other situations. You may be able to adapt it or to get the general idea from it.

Greg McKaskle

Can you tell us where this example is?


It’s with all the other LabVIEW examples on your programming computer.

When you launch LabVIEW, the “Getting Started” window appears. It has a number of tabs down the left side. One of those tabs is “Support”, and it leads to a set of links including “Find FRC Examples…”

I think the specific example Greg is talking about is named “Servo Camera Example.lvproj”. It resides in the FRC Robotics > Vision folder.