> 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.gearing`

`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](/api-reference/java-reference/gearing/gearbox.md)
* [Sprocket](/api-reference/java-reference/gearing/sprocket.md)
* [SmartMotorControllerConfig](/api-reference/java-reference/motor-controllers/smart-motor-controller-config.md)
* [C++ MechanismGearing](/api-reference/c++-reference/gearing/mechanism-gearing.md)
