> 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/api-reference/java-reference/gearing/mechanism-gearing.md).

# MechanismGearing

**Package:** `yams.core.gearing`\
**Javadoc:** [`MechanismGearing`](https://javadocs.yassrobotics.com/yams/yams/core/gearing/MechanismGearing.html)

`MechanismGearing` is the type accepted by `SmartMotorControllerConfig.withGearing()`. It combines a `GearBox` and an optional `Sprocket` into a single ratio describing the motor-to-mechanism reduction.

The constant `MechanismGearing.kOne` represents a 1:1 (direct drive) gearing.

***

## Constructors

```java
MechanismGearing(double reductionRatio)           // Single-value reduction
MechanismGearing(double... reductionRatios)        // Multi-stage, multiplied together
MechanismGearing(GearBox gearBox)
MechanismGearing(GearBox gearBox, Sprocket sprockets)
```

***

## Constants

| Constant                | Description                 |
| ----------------------- | --------------------------- |
| `MechanismGearing.kOne` | 1:1 gearing (direct drive). |

***

## Methods

| Method                       | Returns            | Description                                                                                   |
| ---------------------------- | ------------------ | --------------------------------------------------------------------------------------------- |
| `getRotorToMechanismRatio()` | `double`           | Motor rotations per mechanism rotation (the reduction ratio). For a 10:1 box, returns `10.0`. |
| `getMechanismToRotorRatio()` | `double`           | Mechanism rotations per motor rotation. For a 10:1 box, returns `0.1`.                        |
| `div(double i)`              | `MechanismGearing` | Divides the gearbox portion by `i`.                                                           |

***

## Usage

```java
// A gearbox with a chain stage
MechanismGearing gearing = new MechanismGearing(
    GearBox.fromTeeth(14, 72),      // 5.14:1 gear reduction
    Sprocket.fromStages("18:24")    // 1.33:1 chain reduction
);
// Total: 5.14 × 1.33 ≈ 6.85:1

SmartMotorControllerConfig config = new SmartMotorControllerConfig()
    .withGearing(gearing);
```

{% hint style="info" %}
`getRotorToMechanismRatio()` is what YAMS passes to WPILib's encoder conversion factor. A 10:1 reduction means 10 motor rotations per mechanism rotation, so this method returns `10.0`.
{% endhint %}

***

## See also

* [GearBox](https://yams.yassrobotics.com/api-reference/java-reference/gearing/gearbox.md)
* [Sprocket](https://yams.yassrobotics.com/api-reference/java-reference/gearing/sprocket.md)
* [SmartMotorControllerConfig](https://yams.yassrobotics.com/api-reference/java-reference/motor-controllers/smart-motor-controller-config.md)
* [C++ MechanismGearing](https://yams.yassrobotics.com/api-reference/c++-reference/gearing/mechanism-gearing.md)


---

# 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/api-reference/java-reference/gearing/mechanism-gearing.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.
