Need help with finding shooter angle with vision

We are Using YAGSL and Photon Vision on a Bee link Mini PC and Command Based Java. We have an arm as well as a pivot on our shooter, both with PID and methods to set to a desired angle. I got Photon Vision to successfully add a vision measurement to the Pose Estimator. I am having trouble figuring out where to start with vision programming. I want to take the robot position and calculate an angle to set the shooter at. Any recommendation on where to start would be greatly appreciated.

Maybe the Desmos calculator and the information in this OA post could be a starting point?

If your pose estimator is working, and it’s providing you accurate odometry, then you’ve got the hard part done.

The easiest thing would be to create a lookup table of various distances and shooter values. There may be a way to just interpolate the numbers and set the shooter angle according to the distance to the target.

However, it’s pretty straight forward to measure your distances (in increments you choose), then when you know how far you are away.

For example, in our shooter, it’s about a 12-15 degree difference shooting from the subwoofer to the speaker than from the alliance start line. Any distances in between you can sort of scale linearly and it’s been good enough to hit the shot.

Heyyy, checkout this type of interpolation, ir works pretty well

2 Likes

We use spline interpolation to help our robot know what speed and angle to have the shooter at.

Thank you, I have a Interpolation Double tree map created and inputting values to set the shooter angle. How should I take my current pose on the field to get the distance to the speaker? I have a method created to get the robots pose 2d. Should I take my robots pose and use get distance to the speakers translation2d? or are there better/more efficient ways of doing that?


The method you specified is fine. Just use get distance.

How should I convert my pose 2d to a translation2d for the get distance?

There’s a getTranslation2d() method in Pose2d.
VSCode should be helping you and show you stuff like that.

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