> 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/elevator-config.md).

# ElevatorConfig

An elevator moves a carriage along a line. The [Elevators](https://yams.yassrobotics.com/documentation/understanding/elevators.md) page shows a complete elevator.

`ElevatorConfig` has the [shared options](https://yams.yassrobotics.com/documentation/reference/mechanism-configs/shared-options.md) and four of its own.

## `withCarriageWeight`

Everything the motor lifts: the carriage, whatever is mounted on it, and a game piece if it carries one.

<figure><img src="https://1354553280-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZM0CFmYiQzcrY4zDcTtZ%2Fuploads%2Fgit-blob-766ebdc0ed8b96d0079fea81d926859705e7b140%2Fmech-elevator-carriage.png?alt=media" alt="Two carriages, one of 8 pounds and one of 20 pounds, and a graph of simulated height. With the same gains the 8 pound carriage reaches the setpoint quickly, and the 20 pound carriage rises more slowly and sags below it."><figcaption><p>The same gains on a light and a heavy carriage.</p></figcaption></figure>

```java
new ElevatorConfig().withCarriageWeight(Pounds.of(16));
```

**Used in:** simulation only. **Required** for an `Elevator` to be created in simulation.

## `withAngle`

The angle the elevator is drawn at. The default is 90°, straight up.

<figure><img src="https://1354553280-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZM0CFmYiQzcrY4zDcTtZ%2Fuploads%2Fgit-blob-a46ec80a19e784ce52d1338600683423d8a050f2%2Fmech-elevator-angle.png?alt=media" alt="Three elevators. A vertical elevator, the default at 90 degrees, has gravity simulated. A slanted elevator set with withAngle at 50 degrees is drawn slanted but still simulated with full gravity. A horizontal slide, set with an angle of 0 and withHorizontalElevator, has no gravity simulated."><figcaption><p>withAngle sets the drawing. withHorizontalElevator turns gravity off.</p></figcaption></figure>

```java
new ElevatorConfig().withAngle(Degrees.of(50));
```

{% hint style="warning" %}
`withAngle` only changes the drawing, and the direction [`getPose3d()`](https://yams.yassrobotics.com/documentation/how-to-simulation-and-logging/how-do-i-show-my-mechanisms-on-a-3d-robot-model.md) moves the carriage in. It does not reduce the gravity the simulation applies: a slanted elevator is simulated with full gravity, as if it were vertical.
{% endhint %}

**Used in:** simulation only.

## `withHorizontalElevator`

Turns gravity off in the simulation, for a linear slide that moves level with the ground.

```java
new ElevatorConfig()
    .withAngle(Degrees.of(0))
    .withHorizontalElevator();
```

A slide with no gravity needs no `kG`, so it will want [different simulation gains](https://yams.yassrobotics.com/documentation/reference/editor/config/simulation.md#withsimclosedloopcontroller-and-withsimfeedforward) from a vertical elevator.

**Used in:** simulation only.

## `withStages`

How far each moving stage travels relative to the stage below it, from the stage nearest the fixed stage to the carriage, which is the last. Give one height for each stage that moves: the number of heights is the number of stages. `Elevator.getCascadePose3d()` and `getContinuousPose3d(carriageFirst)` use them to give each stage's pose, to show the stages on an AdvantageScope robot model: see [How do I show an elevator's stages on a 3D robot model?](https://yams.yassrobotics.com/documentation/how-to-simulation-and-logging/how-do-i-show-my-mechanisms-on-a-3d-robot-model/how-do-i-show-an-elevators-stages-on-a-3d-robot-model.md).

```java
new ElevatorConfig()
    // Two stages that each travel 0.6 m, then a carriage that travels 0.5 m.
    .withStages(Meters.of(0.6), Meters.of(0.6), Meters.of(0.5));
```

1 stage, an elevator with only a carriage, is valid, but has no stage poses: both methods need 2 or more stages. `withStages` throws for no heights, or a height that is not positive.

The stages carry the carriage from the bottom to the top, so they also give the elevator's height: without [`withHardLimits`](https://yams.yassrobotics.com/documentation/reference/mechanism-configs/shared-options.md#withhardlimits), the elevator goes from 0 to the stage heights' total, which `getStageHeightTotal()` returns. With hard limits as well, the stage heights must add up to the maximum height, or the `Elevator` throws an `ElevatorConfigurationException` saying how far apart they are.

```java
new ElevatorConfig()
    // 0 m to 1.7 m, from the stages. No withHardLimits needed.
    .withStages(Meters.of(0.6), Meters.of(0.6), Meters.of(0.5));
```

{% hint style="info" %}
`withStages` does not change the gearing. A cascading elevator also needs [`withCascadingElevatorStages`](https://yams.yassrobotics.com/documentation/reference/editor/config/gearing-and-units.md#withcascadingelevatorstages) on its motor config, so the carriage's height is right: see [how the stages are rigged](https://yams.yassrobotics.com/documentation/understanding/elevators.md#how-the-stages-are-rigged).
{% endhint %}

**Used in:** the stage poses, and, when there are no hard limits, the elevator's height range: in simulation, and on the real robot for `max()`, `min()`, `isAtMax()` and `isAtMin()` when no soft limit is set.

## What else an elevator needs

| For                        | Use                                                                                                                                                                                         |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| The physical stops         | [`withHardLimits`](https://yams.yassrobotics.com/documentation/reference/mechanism-configs/shared-options.md#withhardlimits) on `ElevatorConfig`                                            |
| The limits the motor obeys | [`withSoftLimits`](https://yams.yassrobotics.com/documentation/reference/editor/config/limits-and-protection.md#withsoftlimits) on the motor config                                         |
| Heights in meters          | [`withDrumRadius` or `withMechanismCircumference`](https://yams.yassrobotics.com/documentation/reference/editor/config/gearing-and-units.md#withmechanismcircumference) on the motor config |
| A cascading elevator       | [`withCascadingElevatorStages`](https://yams.yassrobotics.com/documentation/reference/editor/config/gearing-and-units.md#withcascadingelevatorstages)                                       |
| Holding against gravity    | [`ElevatorFeedforward`](https://yams.yassrobotics.com/documentation/reference/editor/config/feedforward.md#withfeedforward) with `kG`                                                       |
| A constant force spring    | [Elevators with a constant force spring](https://yams.yassrobotics.com/documentation/how-to-tuning/live-tuning.md#elevators-with-a-constant-force-spring)                                   |

## Code reference

* [`ElevatorConfig`](https://github.com/Yet-Another-Software-Suite/YAMS/blob/master/yams/java/yams/core/mechanisms/config/ElevatorConfig.java)
* [`Elevator`](https://github.com/Yet-Another-Software-Suite/YAMS/blob/master/yams/java/yams/core/mechanisms/positional/Elevator.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/elevator-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.
