Hello Chief Delphi,

The first iteration of our shooter included a fixed angle hood. We tuned our distance-velocity function by just moving the robot and measuring what is the optimal shooter velocity for each distance.

However, for the second iteration we added an adjustable hood controlled by a servo. The tuning in this case is much more complex because we need to tune two parameters instead of one.

Our current solution is having three fixed positions of the hood for short-middle-long range shooting.

Is there a way to tune the hood so it will be more â€ścontinuousâ€ť?

Thank you!

At each position find multiple combinations of velocities+hood angles that work, and then plug it into excel to find an equation for it.

The regression method is an option, but another way of doing that is to do linear interpolation between points: Instead of fitting everything to one equation, have your set of velocities/hood angles that work, and fit a linear equation to each sequential pair, so if your distance is between any two reference points it just picks based on the line between the two points. If your recovery times are low enough though, you can also just shoot as hard as possible from every position, and only focus on changing your angle.

If you already have a solution for a fixed hood position, you may want to just use that hood solution for the range of shooting distances where it was effective and then have a second hood setting for the other distances. For example, if your current hood angle is good for longer range shots (outside the initiation line), then have that as one setting for the hood and just use your current shooter speed settings for those shots. Then add a second hood position that is good for close-in shots and develop a second set of shooter wheel speeds for those short range shots.

You may find that the adjustment of the hood angle is fairly slow with the servo so it may be something you want to select early in your scoring cycle (decide whether you are going to shoot from the trench or shoot from close in as you are moving down the field and pre-select the hood setting for that shooting position). If you change your mind as you are approaching your shooting position, you can push a button to change the hood and by the time you get to your shooting position, the hood should be adjusted.

We placed our robot at increasing distances from the goal (every 12" or so) and manually tweaked the RPM, hood angle, and feed rate into the shooter.

We adjusted the RPM and hood angles such that the apex of the ballâ€™s trajectory in the air was approximately near the goal. Here is a video that we shot during the tuning process for reference.

This method created a relatively â€ścontinuousâ€ť set of speeds and angles. Here is our lookup table for reference:

```
init {
map[75.inches] = ShooterParameters(4300.rpm, 41.5.degrees, 1.0)
map[88.5.inches] = ShooterParameters(4500.rpm, 37.5.degrees, 1.0)
map[110.inches] = ShooterParameters(4700.rpm, 32.5.degrees, 1.0)
map[128.3.inches] = ShooterParameters(4800.rpm, 29.0.degrees, 0.95)
map[141.8.inches] = ShooterParameters(5000.rpm, 26.0.degrees, 0.95)
map[163.6.inches] = ShooterParameters(5080.rpm, 23.5.degrees, 0.9)
map[192.1.inches] = ShooterParameters(5200.rpm, 20.5.degrees, 0.8)
map[204.7.inches] = ShooterParameters(5350.rpm, 18.5.degrees, 0.7)
map[236.1.inches] = ShooterParameters(5550.rpm, 16.5.degrees, 0.66)
map[270.7.inches] = ShooterParameters(5700.rpm, 13.5.degrees, 0.45)
map[285.inches] = ShooterParameters(5820.rpm, 13.0.degrees, 0.40)
map[305.inches] = ShooterParameters(6250.rpm, 11.0.degrees, 0.30)
map[320.inches] = ShooterParameters(6650.rpm, 10.5.degrees, 0.25)
}
```

The last parameter we tuned was something we called â€śfeed rateâ€ť, which represented how fast we should run the feeder for each distance value. The feed rate slows down as we get farther away from the goal to compensate for a longer recovery time associated with a higher RPM.

We linearly interpolated between the values in the lookup table based on a distance value from our Limelight to get a `ShooterParameters`

for each real-world scenario.

One thing to keep in mind is that the more adjustability that you have, the more tuning that you have to do. While it is reasonable to tune for a wide variety of distances at home, it isnâ€™t at competition. If you find the balls at competition react differently then what you tuned with, you may have a lot of trouble getting it working again. In 2017, we had a servo adjusted shooter hood and had it working at home with variable control. However, we ended up limiting it to two positions at competition.

As the balls wear, this could be an even bigger issue with infinite recharge.

As others have said, you may want to keep trying a velocity,angle pair for every distance and narrow it down to one pair per distance that works the best by some definition. Then, youâ€™d want to interpolate between data points for distances you didnâ€™t measure at (so almost every distance, basically!). Our team went with spline interpolation which we expect would give better results than linear interpolation. If youâ€™re curious about this, feel free to look at our code: creating splines from data points, spline code