I got myself thinking about an interesting problem last week. After a few attempts at it, I think I have something workable that people might find interesting. Pardon the long post and the “stream of consciousness” style write-up.
Crux of the Problem
For any given shot that you need a robot to take during a launching game, there are an infinite number of trajectories that you can choose from. What is the “best” trajectory?
How I Got Here
Given a static target position, for any launch angle there is one (and exactly one) launch speed that will hit the target dead center. Using Stronghold as an example (high goal, shooting from the outer works) that graph looks like this:
Each of those points on the line represents one of these trajectories:
These two graphs show some cool stuff. As the launch angle approaches 90, and the “straight line” shot, the required launch velocity approaches infinity. The line between those is a CSC(θ) function. Directly between those two is the shot requiring the minimum possible velocity. If you have less velocity then that, the shot can’t go in.
Or can it?
The big problems with the first analysis are:
- The game piece is always smaller than the goal, which means there is a margin of error on where you can hit the target and still score points. In effect, that CSC(θ) line has some thickness to it.
- A launcher doesn’t always fire at exactly the same speed and angle.
So, factoring in the size of the game piece and target turns that linear graph into something more like this:
Where a shot on the green goes in cleanly, orange and yellow represent the lower and upper rims respectively, and red represents a miss.
Factoring in that a launcher is never totally accurate, you can put a bounding box around an area of this graph that represents any shot that your robot can make, and this is where the data gets more interesting.
The next logical conclusion was to make a plot of:
The shot you’re aiming for, along with all of the worst case scenario shots, given your level of accuracy.
The accuracy of every shot that you can take, given a fixed geometry and error in angle and velocity.
Analyzing a Shot
Once I had my spreadsheet made up, I was able to do some interesting digging. The first thing I did is to make the spreadsheet automatically tell me what my highest percentage shot is. With a robot of the same capability as the example above, you can aim for this flatter, faster shot instead, improving the accuracy from 81% to 92%:
The best shot that you can take is dependent on your launcher’s capability. If you can control the exit velocity tightly but struggle to get the angle dialed in, you can take a slower, higher angle shot and still nail it almost every time.
I also took the liberty of trying out some parameters from other FRC games.
Rebound Rumble: High goals, shooting from the key
The trick here was tightly controlling your velocity, and taking the slower, higher shot. It’s why 16 won.
Aerial Assist: Autonomous shot from the truss
A large game piece and a relatively small goal means lost of opportunity to hit the rims.
Steamworks: Autonomous shot from the hopper
This just shows what everyone knows already: Fuel was hard.
Here is my spreadsheet. Please ignore the horrible mess of tables that this thing runs on.
2019TrajectoryCalculator.xlsm (226.1 KB)
Updated 10/22/19 to fix an error with shots entering the goal at a steep angle
There is a macro in here to auto-scale the graphs. Disable it if you want, but the charts will look uglier.
So, has anyone else done an analysis like this? Does anyone have suggestions on what I could do better?
- Shots fall on a parabolic arc.
- No wind resistance or magnus effect.
- Shots that hit the rim have a fixed likelihood of going in.
- Shots are evenly distributed over the available angles and speeds, instead of being normally distributed.
- I have a hard speed limit put in here, and I have no idea how realistic or unrealistic it is.
- Probably others that I forgot about.