Convert the Model into Robot Commands
Mediumdifficulty
You'll build three lookup tables, from distance to wheel speed, hood position, and flight time. Each lookup returns a value and whether it ran off the end of the table. You'll also measure how close the wheel and hood have to be before firing. The full analysis uses high-speed video and curve fitting, but on an FTC robot what matters most is clear units, table limits, measurements taken at the same moment, and testing on shots you didn't tune with.
You have a trajectory that tolerates errors. Sending its 5.25 m/s exit speed directly to a motor controller still cannot make the shot: the encoder reports wheel motion, and the ball does not leave at the wheel’s surface speed.
Build the static layer first
- Measure the shooter-to-target geometry and define the distance reference.
- Collect stationary shots and create wheel, hood, and rim-time knots.
- Query them with bounded, shape-preserving interpolation that reports clamping.
- Measure wheel and hood readiness instead of assuming a command has been reached.
- Log the requested values, measured values, release time, and result for every shot.
Shooting on the move builds on this. It can't fix a stationary table with the wrong units, distances measured from the wrong spot, or wrong timing.
Worked example: encoder ticks to ball speed
For a wheel radius of 0.0692 m and 28 encoder counts per revolution, an encoder velocity of 1,500 ticks/s corresponds to:
The ball only picks up about a quarter of that. With the measured average ratio, , the ball leaves at about . (That's arithmetic with the average, not a measured shot.)
Increase the encoder reading from 1,500 to 1,650 ticks/s. Which speeds should increase by 10% if η stays fixed? Change the slider and check the conversion, then reset the example.
This calculation applies the pilot mean to a chosen encoder reading. It is not a fitted actuator map or a measured shot at this setting. Angle and wheel contact still require calibration.
Seven tracked shots in the paper averaged η = 0.259, with a standard deviation of 0.031 (95% interval for the average: 0.230 to 0.288). Those shots used different speeds, angles, and distances, so the spread shows how much η varies between settings, not how repeatable one setting is. The camera wasn't calibrated precisely enough to measure drag, just this ratio. Source: paper §9.
Measure a stronger transfer estimate
For launch , synchronize the wheel encoder and ball measurement at release, then calculate:
You need two measurements at the same moment: the wheel's surface speed when the ball leaves, and the ball's speed then. Averaging the wheel speed over a longer stretch throws η off, because the wheel slows down while it pushes the ball.
Several ways to measure better than one uncalibrated video:
| Method | What it measures well | Main limitation |
|---|---|---|
| Two optical gates near the exit | Transit time over a surveyed baseline gives a direct local speed without differentiating video pixels. | The wide, perforated ball can interrupt a beam inconsistently; use multiple beams or a light curtain and calibrate the trigger geometry. |
| High-frame-rate video + backward integration | A tracked post-release state can be propagated backward through the drag model to the release plane. It also estimates launch angle. | Pixel noise first enters a velocity difference, then grows during backward propagation. Camera geometry, release time, and the force model must be known. |
| Multi-frame forward fit | Every tracked center constrains one release speed and angle. Residuals reveal a poor fit instead of hiding it in one derivative. | It needs an optimizer and calibrated timestamps. A short arc usually cannot identify exit speed and drag coefficient independently. |
| Radar or a validated ball chronograph | Direct speed measurements make a useful independent reference for the camera pipeline. | Alignment, measurement volume, and a nonstandard perforated projectile must be checked experimentally. |
Use Clean 480 fps, then add one pixel of position noise. Move the backtracking frame later in the flight and compare the three-frame estimate with the 18-frame forward fit. Higher frame rate reduces time discretization and motion blur, but a shorter frame interval also makes a two-frame velocity estimate more sensitive to pixel noise.
The backward estimate takes a centered-difference velocity at the selected frame and runs the same drag ODE toward release with a negative time step. The forward fit searches release speed and angle, integrates every candidate forward, and minimizes position error across 18 frames. These are synthetic teaching data; they are not additional measurements from the paper.
Backward with the same integrator
Suppose calibrated video provides three consecutive ball centers around time . Estimate velocity with the centered difference
form the state , and run RK4 with a negative step until the estimated release time. The recovered velocity magnitude divided by synchronized wheel surface speed gives η. Use early post-release frames: reversing a dissipative drag model amplifies state and model errors, so a long backward reconstruction is fragile.
The experiment uses this procedure exactly, with synthetic camera noise and the paper’s flight equations. It then compares a stronger batch estimate:
Each candidate release state is integrated forward to all observed frames. This avoids constructing one noisy instantaneous velocity and produces a residual in millimetres that can be inspected. A production fit should also account for camera calibration uncertainty and reject frames where the ball is occluded or blurred.
A practical collection protocol
- Place a surveyed calibration board in the launch plane, correct lens distortion, use a short exposure, and verify the true frame timestamps instead of trusting only the nominal FPS label.
- Record the encoder at high rate. Add a visible synchronization LED or electrical trigger so the video and encoder clocks share a release event.
- Track the ball center for the first clear frames after it loses contact. Keep the raw pixels, confidence score, timestamps, hood setting, ball ID, battery voltage, and wheel-speed trace.
- Estimate exit speed with optical gates or the multi-frame fit. Use backward integration as a cross-check; disagreement larger than the stated uncertainty is a reason to inspect timing, camera geometry, or the model.
- Repeat each fixed configuration enough times to measure shot-to-shot spread, then validate the resulting command map on held-out distances and balls.
Don't assume η is one fixed number. Measure how it changes with the things that affect contact, like wheel speed, hood position, squish, and ball wear. Shuffle the order of settings so the battery warming up doesn't look like η changing with speed. These are suggestions for a better experiment; the paper only has the seven-shot estimate above.
Query three calibrated maps
The deployed pipeline is:
Estimated distance → flywheel target + hood position + rim flight time → ready bands → release.
The wheel and hood values started from the simulator and were then adjusted with real shots. The flight times are the time to reach the rim on the way down. That's more accurate than treating one η as the whole story.
The simulator's sweep_targets and build_lut outputs are predictions, a starting point for test
shots. The robot's Distances, velValues, and hoodValues arrays are in robot units: inches, ticks
per second, and servo position. A hood position of 0.3 isn't 0.3 radians, and 5.25 m/s isn't an encoder
setting. Write down where distances are measured from and what the flight time measures, next to each
table.
Return everything from a lookup together: distance, wheelTarget, hoodTarget, rimTofSeconds,
clamped, and calibrationRevision. Then later code can refuse a distance off the table, and the logs
show exactly which table produced each shot.
Between measured distances, the in-between values should follow the shape of the data. A natural cubic spline can bulge upward between equal values. A monotone cubic Hermite interpolation keeps a flat stretch flat.
This is a cropped portion of the deployed map. The natural spline is a comparison through these same knots. The shelf should stay at 1,700 ticks/s between 100 and 120 inches.
The flat stretch comes from the season's launcher table: 100, 110, and 120 inches all ask for 1,700 ticks/s. Compare the curves near 105 inches. A bump there would be something the interpolation made up, not something anyone measured. The demo uses the whole table and shows the 80 to 130 inch part.
How monotone Hermite avoids the bulge
First compute the secant slope between adjacent knots. Flat intervals get zero tangents at both ends; tangents opposing the secant are also zeroed. For a nonzero secant , normalize the two endpoint tangents as and . The Fritsch–Carlson construction projects them into the sufficient monotonicity region .
That keeps each stretch between two measurements from overshooting. It doesn't make the measurements themselves right. Source: paper §5.7 and its Fritsch–Carlson reference.
A bug to know about: the season's Java computes but only limits the slopes when , when it should when . The lesson's version uses 3. Equal values still get flat slopes in the Java, so the flat stretch above is fine, but other tables might overshoot. Check every stretch when you change the table.
Recover before the next release
A shot removes energy from the wheel. A simplified plant makes that disturbance easy to inspect: press Fire, then compare recovery with feedforward, proportional feedback, and an aggressive under-speed mode enabled or disabled.
A simplified plant with illustrative gains, not a replay of measured robot telemetry. Press Fire to remove stored wheel energy, then compare recovery modes.
The demo's numbers are made up for illustration, not from the paper. Use the feedforward lesson to design the controller, and log real recovery times before deciding how close the wheel has to be before firing.
What the season motor controller actually does
The season velocityController.java computes feedforward, scales that term by nominal/measured battery voltage, and adds PID feedback. With bang-bang enabled, a large error then replaces the combined command:
| Condition | Command before the final clamp |
|---|---|
| More than 110 ticks/s below target | +1.0 motor power |
| More than 50 ticks/s above target | −0.2 motor power |
| Between those thresholds | PID + voltage-compensated feedforward |
The defaults are , , , and , all in motor power rather than volts. The −0.2 power actively brakes the wheel, which slows it faster than just coasting at zero.
The season's isReady() only checks the wheel speed. The wheel-and-hood check below is how it should
work, but note that a commanded servo position doesn't tell you the hood actually got there.
The newer robot is a different deployment
At 8374312f, the launcher defaults to useRST = true. Its dispatch selects RST before the alternate Team254 and legacy controllers. The newer distance table requests 1,950 ticks/s at both 110 and 127 inches, rather than the season's 1,700-tick shelf.
The RST implementation is built from measured feedforward constants, as in RST pole placement. With a new controller and new tables, the paper's season results don't apply until it's tested again.
Java: request release only inside the ready bands
boolean launcherReady(double wheelTarget, double wheelMeasured,
double hoodTarget, double hoodMeasured) {
if (!Double.isFinite(wheelMeasured)
|| !Double.isFinite(hoodMeasured)) return false;
return Math.abs(wheelTarget - wheelMeasured) <= wheelReadyBand
&& Math.abs(hoodTarget - hoodMeasured) <= hoodReadyBand;
}
Measure the bands on the mechanism, in the same units as the signals. Waiting for one exact encoder value would never happen. This is one part of the decision to fire; the table lookup has to be valid too, and the feeder delay comes after.
The combined release gate
Before starting the feeder, require a lookup that's on the table, a recent pose and velocity if the robot is moving, an aim calculation that settled, the wheel, hood, and turret all ready, and the robot in a state where firing is allowed. Log which check stopped each shot, so "the shooter wasn't ready" turns into something you can actually fix.
The measured targets at 100, 110, and 120 inches are all 1,700 ticks/s. What should a monotone table return at 105 inches? Does that tell you the ball’s exact exit speed? 1,700 ticks/s. That's a wheel setting, though. The ball's actual speed still depends on how well the launcher passes speed to it, which the table doesn't measure.Show solution
Next: compensate for robot motion.