Ways of using distance measurings to decide shooter power

Hey, so I’m looking for ways to shoot from different positions in the field using a limelight, but I’ve found my algorithms to be flawed and not really effective, so… how are you doing that translation from the target’s angle to shooter’s output?

1 Like

You could attempt to create a look up table. Record maybe the height of the contour along with a distance. You want to make sure that you base your distances off of something that will read consistently at certain distances. For example, you don’t want your reading to be affected by the angle of the target.

It depends on what shooter you have

if you mean the hood I’m using a static hood

We’re doing it the simple way, and it seems to work.

Start with the robot at its closest firing position. Measure the distance to the goal using the position of the target in the limelight image, and then adjust the speed until you find a trajectory you like. Write the speed down. Move the robot back a bit, and adjust the speed again, write it down. Keep doing that until you’ve covered the range of distances you care about. Once you’ve taken a bunch of measurements, plot the data points in excel, and put a polynomial trendline over them. Take the equation off the trendline, and put it into the code to set the target speed for the shooter. The ideal speed is going to be high when you’re close up, low in the middle distance, and then come back up as you go further back.

6 Likes

That is how we are doing it as well. We are planning on calibrating our cameras to get exact distances in the future.

1 Like

You say “Shooter Power” in the title, but I hope you really mean flywheel RPM.

Our team created an interpolation table. We tested different RPMs for our flywheel and created a table of the optimal RPM for various distances from 4 feet out to about 21 feet. For distances in between any of our data points we use linear interpolation between the two closest values in the table.

This is what we plan to do in the near future. Just make sure when you are doing this to use both good and bad balls to reflect the field situation.

We started with this but decided to simplify it even further. We had a quadratic regression calculated for week 1, but quickly found out that as ball quality degraded, we would need to retune the values on the practice field. The issue was that there wasn’t enough practice field time to be able to effectively collect 10+ data points that we wanted for the regression to be accurate. Also, our power cell quality (the ones we brought in for testing) were never as bad as the ones on the field, so our testing wasn’t super useful anyway.

We found that having just a few (4, in our case) setpoints is sufficient to be able to reliably hit outer ports shots from many distances, while also being able to reliably hit inner port shots with ~4-5ft of distance variability. The advantage of this system is if we find we’re missing certain shots on the field, we know exactly which setpoint to adjust for the next match. We don’t see the downside of reduced accuracy, since we weren’t able to hit inner port shots from beyond a few feet past the initiation line anyway.

A simple way to do this is by using interpolation. If you know your current distance to the target (LIDAR module in our case, though solve PNP works too), simply move your bot around the field, and record the rpm/angle required to hit the target. Put all of these points into an array and interpolate based on your known distance. If you want to take this approach, I suggest looking into spline interpolation. Theoretically, with enough setpoints, your bot should be able to shoot from anywhere within its max range.

This is how we were doing it as well, however we went another step. Once we got the ‘desired’ velocity for each point, we also measured other velocity and hood angle variations that would result in a made shot. We then used the data analysis pack in excel to do a 3 variable linear regression (distance, speed, hood).

From that, we were able to use a live hood that was constantly adjusting based on 2 variables, distance and velocity. So we didn’t wait for our second shot to get back up to speed: the hood was constantly adjusting so it would make the shot at whatever speed the shooter motor was running at. It was neat to watch.

4 Likes

That’s exactly how I would do it if we had an adjustable hood. Later shots in the volley have a higher arc, but they all hit the target.

That sounds really useful to unload 5 shots quickly. How did you determine the other variations that would result in a made shot? Was it based on the min and max RPM that a shot will make at a distance?

Nope. The regression is much like a trendline, but you get an equation with 3 variables. Something like:
A*(distance)+B*(speed)+C*(hood)+D=0

You know the distance and speed, and solve for the hood.

Here is the example I used with our team members:
https://stattrek.com/multiple-regression/excel.aspx

2 Likes

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