I want to make a code that takes a minimum distance we might shoot at and calibrate our hooded shooters position using a servo, then a maximum distance and calibrate the position so that we can calculate the positions inbetween. We are using limelight and I have it tracking targets using tx already, I just want to know if there is some kind of range function I could use or some table function and how I could set that up. Thanks!

You might want to look at the interpolation functions (especially Interpolate 1D Array Function and Interpolate 1D VI) . You can also combine that with an In Range and Coerce to ensure the value is valid.

Else, you can also evaluate creating a function that reassembles better the range you have. You can see multiple examples of interpolation, optimization and linear algebra solving in: LabVIEW Help tab > Find Examples… > Analysis, Signal Processing and Mathematics.

Thank you! I’ll look into that now!

If you do the 1-D lookup table, after gathering all your data, be sure to include a denser mesh of points where the curve has significant curvature. You can use a looser mesh of points where the curve is close to linear.

Are you doing anything to control your wheel speed? If not, and you don’t have encoders on your shooter, at least run the shooter in a voltage compensation mode. Many (alll?) of the CAN controllers support this natively, but even with PWM you can read your battery voltage and use it to do the scaling yourself. Your percentage throttle should be inversely proportional to the measured voltage. E.g., if you run at 50% when your voltmeter reads 12V, you should run it at 60% when it reads 10V and 46% when it reads 13V. That is, throttle_percentage = Base_throttle_percentage * nominal_voltage / measured_voltage.

I am running Talon SRX mag encoders in velocity mode for the shooter wheel. I just want to be able to plot a few points and positions with the servo so the code can do the calculations. Kind of like an array I think?

EXAMPLE: If I have x=1 and y =2, then x=4 and y=8, then if x=3 I want it to know that y=6.

If you’re running encoders, please ignore my voltage compensation stuff – it was totally intended as a hack around not having encoders.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.