> For the complete documentation index, see [llms.txt](https://yams.yassrobotics.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yams.yassrobotics.com/documentation/how-to-mechanisms/how-do-i-shoot-on-the-move.md).

# How do I shoot on the move?

Where to learn shooting on the move, which YAMS call does each part, and the worked example.

**Goal:** score while the robot is still driving, instead of stopping to line up first.

Start with [Shoot on the move: worked example](https://yams.yassrobotics.com/documentation/how-to-mechanisms/how-do-i-shoot-on-the-move/shoot-on-the-move-example.md): it builds a robot that aims, sets its shooter speed from a lookup table, and feeds only when the shot is ready, in Java with Commands v2 and Commands v3. This page lists where to learn the math, and which YAMS call does each job the sources ask for. [Shooting on the move](https://yams.yassrobotics.com/documentation/understanding/shooters.md#shooting-on-the-move) explains the idea, and what the [Swerve Input Stream](https://yams.yassrobotics.com/documentation/reference/swerve-input-stream.md) does and does not do for you.

We covered this in a YASS Weekly Workshop, **How To Program Target Tracking And Shooting On The Fly for FRC**:

{% embed url="<https://www.youtube.com/watch?v=pa-HMLTHYvo>" %}

## Read these first

| Source                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | Read it for                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Shooting on the Fly](https://blog.eeshwark.com/robotblog/shooting-on-the-fly) and [Shooting on the Fly, Part 2: The LUT Approach](https://blog.eeshwark.com/robotblog/shooting-on-the-fly-pt2), by Eeshwar                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | The best place to start. Part 1 explains the idea as plain vector math, then covers what goes wrong on a real robot: latency, a flywheel that slows and slips, spin and drag, lobbed shots, and a shooter that is itself moving. Part 2 is the practical side: building the lookup table, getting the shot's speed from the time of flight, shooters with a hood, and tuning the latency. |
| WPILib's [Fire Control](https://frc-docs--3242.org.readthedocs.build/en/3242/docs/software/advanced-controls/fire-control/index.html) pages: [Static Shooting via Look-Up Table](https://frc-docs--3242.org.readthedocs.build/en/3242/docs/software/advanced-controls/fire-control/static-shooting.html), [Dynamic Shooting via Time-of-Flight Recursion](https://frc-docs--3242.org.readthedocs.build/en/3242/docs/software/advanced-controls/fire-control/dynamic-shooting.html), [Newton's Method for Dynamic Shooting](https://frc-docs--3242.org.readthedocs.build/en/3242/docs/software/advanced-controls/fire-control/newton-shooting.html) and [Linear Drag (First-Order Air Friction)](https://frc-docs--3242.org.readthedocs.build/en/3242/docs/software/advanced-controls/fire-control/linear-drag.html) | Three firing strategies and a drag correction, with interactive simulations that show where each one converges and where it does not.                                                                                                                                                                                                                                                     |
| [Shoot on the move from the code perspective](https://www.chiefdelphi.com/t/shoot-on-the-move-from-the-code-perspective/511815) (Chief Delphi)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | A short explanation of the virtual target, with links to much of the rest.                                                                                                                                                                                                                                                                                                                |
| [Time of Flight Determination](https://www.chiefdelphi.com/t/time-of-flight-determination/512542) (Chief Delphi)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | The different ways teams measure or calculate the time of flight.                                                                                                                                                                                                                                                                                                                         |
| [Shoot While Move Code (1706)](https://www.chiefdelphi.com/t/shoot-while-move-code-1706/410494) (Chief Delphi)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Team 1706 walking through its 2022 code.                                                                                                                                                                                                                                                                                                                                                  |
| [Orbit 1690 Online Software Sessions](https://www.chiefdelphi.com/t/orbit-1690-online-software-sessions/467221) (Chief Delphi)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Recorded sessions from Team 1690 on their swerve and system control software.                                                                                                                                                                                                                                                                                                             |
| [Mechanical Advantage 6328's `LaunchCalculator.java`](https://github.com/Mechanical-Advantage/RobotCode2026Public/blob/main/src/main/java/org/littletonrobotics/frc2026/subsystems/launcher/LaunchCalculator.java)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | A complete launch calculator from a 2026 robot.                                                                                                                                                                                                                                                                                                                                           |
| [Hammerheads 5000's `TurretCalculator.java`](https://github.com/hammerheads5000/2026Rebuilt/blob/main/src/main/java/frc/robot/subsystems/turret/TurretCalculator.java), with a [build thread post](https://www.chiefdelphi.com/t/frc-5000-hammerheads-2026-build-thread-open-alliance/507502/129) that walks through it                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | A complete shot calculator for a turret from a 2026 robot.                                                                                                                                                                                                                                                                                                                                |

{% hint style="info" %}
The WPILib fire control pages are a work in progress in [wpilib-docs #3242](https://github.com/wpilibsuite/wpilib-docs/pull/3242). They have not been merged, so the links go to the pull request's preview and may move.
{% endhint %}

## How the sources' ideas apply to YAMS

Each row is a concept from the sources, where to read about it, and the YAMS piece that does that job.

| Concept                                                                            | Read about it in                                                                                                                                                                                                                                                                                                | In YAMS                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ---------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| The robot's position and field velocity                                            | Eeshwar's [part 1](https://blog.eeshwark.com/robotblog/shooting-on-the-fly), "Prerequisites"                                                                                                                                                                                                                    | `drive.getPose()` and `drive.getFieldRelativeSpeed()` on the [Swerve Drive](https://yams.yassrobotics.com/documentation/understanding/swerve-drive.md)                                                                                                                                                                                                                                                                                                                                                                              |
| A lookup table of shots that score, measured standing still                        | [Static Shooting via Look-Up Table](https://frc-docs--3242.org.readthedocs.build/en/3242/docs/software/advanced-controls/fire-control/static-shooting.html), and Eeshwar's [part 2](https://blog.eeshwark.com/robotblog/shooting-on-the-fly-pt2)                                                                | WPILib's [`InterpolatingDoubleTreeMap`](https://github.wpilib.org/allwpilib/docs/development/java/org/wpilib/math/interpolation/InterpolatingDoubleTreeMap.html), with the result sent to a [FlyWheel](https://yams.yassrobotics.com/documentation/understanding/shooters.md)                                                                                                                                                                                                                                                       |
| A flywheel speed that changes every loop                                           | Eeshwar's [part 1](https://blog.eeshwark.com/robotblog/shooting-on-the-fly), "Wait, The Shooter Speed Changed?"                                                                                                                                                                                                 | `FlyWheel.run(Supplier)`, which reads the supplier every loop                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Turning to face a point while the driver keeps driving                             | Every source                                                                                                                                                                                                                                                                                                    | [`withAim`](https://yams.yassrobotics.com/documentation/reference/swerve-input-stream/swerve-input-stream-aim.md#aim-at-a-target), which takes a supplier so the point can move every loop                                                                                                                                                                                                                                                                                                                                          |
| A time of flight lead, as a virtual target                                         | [Dynamic Shooting via Time-of-Flight Recursion](https://frc-docs--3242.org.readthedocs.build/en/3242/docs/software/advanced-controls/fire-control/dynamic-shooting.html), and [Shoot on the move from the code perspective](https://www.chiefdelphi.com/t/shoot-on-the-move-from-the-code-perspective/511815)   | You calculate it. Give the result to `withAim`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| A time of flight lead, as a shot vector with the robot's velocity subtracted       | Eeshwar's [part 1](https://blog.eeshwark.com/robotblog/shooting-on-the-fly), "The Math Implementation", and [part 2](https://blog.eeshwark.com/robotblog/shooting-on-the-fly-pt2), "Getting Horizontal Velocity from ToF"                                                                                       | You calculate it. Give its direction to `withAim`, [`withHeading`](https://yams.yassrobotics.com/documentation/reference/swerve-input-stream/swerve-input-stream-aim.md#heading-snap-control) or a turret, and its speed to the flywheel                                                                                                                                                                                                                                                                                            |
| Latency compensation: aim from where the robot will be                             | Eeshwar's [part 1](https://blog.eeshwark.com/robotblog/shooting-on-the-fly), "Latency Compensation", and [part 2](https://blog.eeshwark.com/robotblog/shooting-on-the-fly-pt2), "The Latency Constant"                                                                                                          | [`withAimLookahead`](https://yams.yassrobotics.com/documentation/reference/swerve-input-stream/swerve-input-stream-aim.md#aim-lookahead)                                                                                                                                                                                                                                                                                                                                                                                            |
| A heading that keeps up with a moving aim point                                    | Specific to turning the whole robot. The sources mostly aim a turret                                                                                                                                                                                                                                            | [`withAimFeedforward`](https://yams.yassrobotics.com/documentation/reference/swerve-input-stream/swerve-input-stream-aim.md#aim-feedforward), and the rotation controller in [`SwerveDriveConfig`](https://yams.yassrobotics.com/documentation/reference/mechanism-configs/swerve-drive-config.md)                                                                                                                                                                                                                                  |
| A shooter that does not point out of the front, or a small aim correction for spin | Eeshwar's [part 1](https://blog.eeshwark.com/robotblog/shooting-on-the-fly), "The Magnus Effect and Air Resistance"                                                                                                                                                                                             | [`withAimHeadingOffset`](https://yams.yassrobotics.com/documentation/reference/swerve-input-stream/swerve-input-stream-aim.md#aim-heading-offset)                                                                                                                                                                                                                                                                                                                                                                                   |
| Only shooting when the shot is trustworthy                                         | [Dynamic Shooting via Time-of-Flight Recursion](https://frc-docs--3242.org.readthedocs.build/en/3242/docs/software/advanced-controls/fire-control/dynamic-shooting.html), "Shot Quality in Practice", and Eeshwar's [part 1](https://blog.eeshwark.com/robotblog/shooting-on-the-fly), "Shooter Wheel Dynamics" | [`aimLock`](https://yams.yassrobotics.com/documentation/reference/swerve-input-stream/swerve-input-stream-aim.md#aim-lock) for the heading. For the speed, compare the flywheel with the speed the shot needs right now, as the worked example's `atSpeed(Supplier)` does in [Add to the shooter](https://yams.yassrobotics.com/documentation/how-to-mechanisms/how-do-i-shoot-on-the-move/shoot-on-the-move-example.md#add-to-the-shooter): `FlyWheel.near(...)` takes a fixed speed, which goes stale as the target speed changes |
| A hood, or a turret                                                                | Eeshwar's [part 2](https://blog.eeshwark.com/robotblog/shooting-on-the-fly-pt2), the hood variants, and the two team calculators                                                                                                                                                                                | An [Arm](https://yams.yassrobotics.com/documentation/understanding/arms.md) or a [Pivot](https://yams.yassrobotics.com/documentation/understanding/turrets-wrists.md), each in its own subsystem                                                                                                                                                                                                                                                                                                                                    |

## Tuning the YAMS side

The sources cover how to tune the shot itself. These are the YAMS settings that go with their advice:

| Their advice                                                                                                                                                                                                                                      | The YAMS setting                                                                                                                                                                                                                                                                                                   |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Get the standing shot consistent before anything else (Eeshwar's [part 1](https://blog.eeshwark.com/robotblog/shooting-on-the-fly), "Prerequisites")                                                                                              | The flywheel's gains: see WPILib's [Tuning a Flywheel Velocity Controller](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/introduction/tuning-flywheel.html) and [How do I shoot with a shooter?](https://yams.yassrobotics.com/documentation/how-to-mechanisms/how-to-shoot-with-a-shooter.md) |
| Tune the latency constant by driving straight across the front of the target (Eeshwar's [part 2](https://blog.eeshwark.com/robotblog/shooting-on-the-fly-pt2), "The Latency Constant")                                                            | The time you give [`withAimLookahead`](https://yams.yassrobotics.com/documentation/reference/swerve-input-stream/swerve-input-stream-aim.md#aim-lookahead). Start at 0.1 seconds                                                                                                                                   |
| A moving shot is only as good as the pose it starts from                                                                                                                                                                                          | Vision measurements into the drive's pose estimate: see WPILib's [Pose Estimators](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/state-space/state-space-pose-estimators.html)                                                                                                                 |
| Watch whether the heading keeps up as you drive past                                                                                                                                                                                              | The rotation controller in [`SwerveDriveConfig`](https://yams.yassrobotics.com/documentation/reference/mechanism-configs/swerve-drive-config.md), then [`withAimFeedforward`](https://yams.yassrobotics.com/documentation/reference/swerve-input-stream/swerve-input-stream-aim.md#aim-feedforward)                |
| Hold fire when the shot is not trustworthy ([Dynamic Shooting via Time-of-Flight Recursion](https://frc-docs--3242.org.readthedocs.build/en/3242/docs/software/advanced-controls/fire-control/dynamic-shooting.html), "Shot Quality in Practice") | The tolerance you give [`aimLock`](https://yams.yassrobotics.com/documentation/reference/swerve-input-stream/swerve-input-stream-aim.md#aim-lock), and the speed tolerance in the worked example's `atSpeed(Supplier)`                                                                                             |

## WPILib building blocks

The released WPILib documentation covers the classes the example uses. These pages are written for WPILib 2026. The ideas are the same in 2027, though some classes were renamed: `ChassisSpeeds`, for example, is `ChassisVelocities`.

| Page                                                                                                                                                            | Why it matters here                                                            |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| [Coordinate System](https://docs.wpilib.org/en/stable/docs/software/basic-programming/coordinate-system.html)                                                   | Which way X, Y and a positive rotation point.                                  |
| [Translation, Rotation, and Pose](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/geometry/pose.html)                                         | The classes that the distance and direction to the target are calculated with. |
| [Transformations](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/geometry/transformations.html)                                              | Getting from the center of the robot to where the shooter really is.           |
| [Introduction to Kinematics and The ChassisSpeeds Class](https://docs.wpilib.org/en/stable/docs/software/kinematics-and-odometry/intro-and-chassis-speeds.html) | Robot relative and field relative velocity.                                    |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://yams.yassrobotics.com/documentation/how-to-mechanisms/how-do-i-shoot-on-the-move.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
