> 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/reference/mechanism-configs/flywheel-config.md). Agents can also search and read this documentation through its [MCP server](https://yams.yassrobotics.com/~gitbook/mcp).

# FlyWheelConfig

A flywheel is anything that spins to a speed: shooters, rollers, intakes, feeders and indexers. The [Shooters](https://yams.yassrobotics.com/documentation/understanding/shooters.md) page shows a complete flywheel.

`FlyWheelConfig` has the [shared options](https://yams.yassrobotics.com/documentation/reference/mechanism-configs/shared-options.md) except hard limits, and two of its own.

## `withDiameter`

The diameter of the wheel.

<figure><img src="https://1354553280-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZM0CFmYiQzcrY4zDcTtZ%2Fuploads%2Fgit-blob-babbb75421fd9c4ce31766c309aa5ef9e853b193%2Fmech-flywheel-diameter.png?alt=media" alt="A flywheel with its diameter marked, spinning at 3000 RPM and throwing a game piece from its surface. For a 4 inch wheel the circumference is 0.319 meters, 3000 RPM is 50 rotations per second, and the surface speed is 16 meters per second. getLinearVelocity and getAngularVelocity on the config convert between the two."><figcaption><p>The diameter converts rotation speed to surface speed.</p></figcaption></figure>

```java
FlyWheelConfig config = new FlyWheelConfig().withDiameter(Inches.of(4));

LinearVelocity  surface = config.getLinearVelocity(RPM.of(3000));
AngularVelocity spin    = config.getAngularVelocity(MetersPerSecond.of(16));
```

It is used for the drawing, and to convert between how fast the wheel spins and how fast its surface moves. The conversions throw a `FlyWheelConfigurationException` if no diameter is set.

**Used in:** simulation and on the real robot. The conversions work on the real robot. The drawing is simulation only.

## `withSpeedometerSimulation`

Draws the flywheel's speed as a needle instead of a line that spins with the wheel.

<figure><img src="https://1354553280-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZM0CFmYiQzcrY4zDcTtZ%2Fuploads%2Fgit-blob-428e53fa18b7599e737df17e42795a9cfbf3c636%2Fmech-flywheel-speedometer.png?alt=media" alt="Two Mechanism2d windows. Without the speedometer the flywheel&#x27;s line spins with the wheel and is a blur at speed. With withSpeedometerSimulation and a maximum of 6000 RPM, the line points at the speed like a dial: straight down at zero, to the left at half and straight up at the maximum. Here it shows 3720 RPM."><figcaption><p>The flywheel's Mechanism2d with and without the speedometer.</p></figcaption></figure>

```java
new FlyWheelConfig().withSpeedometerSimulation(RPM.of(6000)); // the speed at the top of the dial
```

Give it the fastest speed you expect. `disableSpeedometerSimulation()` turns it back off.

`withSpeedometerSimulation()`, with no speed, turns it back on with the speed you gave before, for example on a copy of a config that had it turned off. It throws a `FlyWheelConfigurationException` if no speed was ever given.

**Used in:** simulation only.

## What else a flywheel needs

| For                                  | Use                                                                                                                                                         |
| ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| How heavy the wheel is in simulation | [`withMomentOfInertia`](https://yams.yassrobotics.com/documentation/reference/editor/config/simulation.md#withmomentofinertia) on the motor config          |
| Holding a speed                      | [`SimpleMotorFeedforward`](https://yams.yassrobotics.com/documentation/reference/editor/config/feedforward.md#withfeedforward) with `kV`, plus a small `kP` |
| A smooth spin up                     | [A velocity profile](https://yams.yassrobotics.com/documentation/reference/editor/config/motion-profiles.md#velocity-profiles-for-flywheels)                |
| A roller that only needs a voltage   | [`ControlMode.OPEN_LOOP`](https://yams.yassrobotics.com/documentation/reference/editor/config/motor-basics.md#withcontrolmode)                              |
| Coasting when stopped                | [`MotorMode.COAST`](https://yams.yassrobotics.com/documentation/reference/editor/config/motor-basics.md#withzeropower)                                      |

## Code reference

* [`FlyWheelConfig`](https://github.com/Yet-Another-Software-Suite/YAMS/blob/master/yams/java/yams/core/mechanisms/config/FlyWheelConfig.java)
* [`FlyWheel`](https://github.com/Yet-Another-Software-Suite/YAMS/blob/master/yams/java/yams/core/mechanisms/velocity/FlyWheel.java)


---

# 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/reference/mechanism-configs/flywheel-config.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.
