The rectangle vision code exampled provided, is a good start. Once you get that integrated into your code, it will find all the targets in it’s FOV.
You’ll need to write some code to select a single target. In our case, we selected the highest target seen. Which I believe if I remember right, would be the highest “Y” value. Once we selected the a single target, we then used the X and Y and distance values from that target.
The X value is what you want from your target to move your turret. Since the scaling of the values from rectangle vision code are -1 to 1, it makes for some EASY PID programming. If your camera is directly on center with your shooter, your setpoint will be ZERO in your PID function block. Your target “X” information will be your input and your output will be motor control to your turret.
That’s the AIMING PART.
Distance can be used to adjust the speed or angle. In our case, we choose SPEED. There is a thing I learned from one our team programmers Luke Pike about interpolated arrays in Labview. This allowed us to use a “lookup table”.
The basic logic is "when distance is: ?, then look up the speed point value in the lookup table, then set the speed of the shooter wheel. The only problem we saw is that when shooting at angle, the distance reported from the example code will not be correct because it’s based on scaling the size of the seen rectangle into a dimension world value. Very clever and works great, but you need to be looking at the target pretty much perpendicular. In the case of this game, shooting from the key worked in most cased and only skewed the value 0.5 feet to 1 feet. This wasn’t enough to mess up the set-point values from the wheel.
In our case, the logic seems to work, but we are dealing with compression problems on the mechanical side, and now wished maybe we would have designed a signal shooter wheel and a fixed back plate. We see alot of shooters designed this way are more immune to the ball compression then the double shooting wheel design. We have noted that a single shooter wheel design needs to be turning almost twice as fast as a double shooter wheel. IN wattage of motor power, we are using two fisher price at around 350 watts, and most of the single shooter wheel designs need 4 motors or close to 700 watts of power.
We never solved the angled shots, I see in the Robonauts video, their software seems to account for the angled shots. Glad someone figured that out, we ran out of time.
Hope that gives some basic guidance in “concepts” of control theory.