Problem with Limelight Distance

Am I doing this correctly? I have a formula that I pulled from the Limelight documentation and it seems when my value goes from positive ty to negative (as we pull farther away) the distance goes wonky and we arent shooting at the correct RPMs we made. (I am using interpolation to convert distance to RPMs using set distances and encoder counts we know). It works perfectly until we pass that threshhold.

Aren’t your RPM’s going to reverse at the zero threshold and start to go down?
Because of the absolute value it becomes an inverted bell curve.

Thats not an absolute value, its a round towards infinity. We were having issues with the ty changing too much and I decided that it would be best to round it so it doesnt change rpms alot

I see now.
Have you plotted the values coming out of this to see what is changing in the curve?
What are the range of ty values you are getting in your application testing?
Still looks like a possible choppy recurve to me, not a generally linear slope.
And the division by zero when ty=0 should probably be avoided.

So I made a mistake and my ty stays negative the whole time, the problem is that the interpolation doesnt seem to be working correctly. Im connected to the bot so Ill drop this phone picture.

I’d add an indicator to display what indexes are coming out of that ty calculation.
I think you are assuming them to be values from 0 to 6?

I might plot the full range of regularly spaced values coming out of ty and interpolating through that cluster of points to see if it’s what you expect.

Im trying to get the distance and when I put indicators after the equation, they stay at 0. Maybe I set something up incorrectly?

Sounds like ty is not updating right now and you’re getting the default 0 value (and the indeterminate divided by zero result).

How can I make sure its working correctly? Am I pulling the network tables entry correct?

The /limelight/ty path looks correct. (wait, no starting slash)

You can inspect the values on the default Dashboard under the variables tab.
If the limelight isn’t connecting then you won’t see any values.

Wait, no starting slash, e.g., limelight/ty

P.S. but I’m not sure that matters.