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

# Smart motor controllers

A `SmartMotorController` is how YAMS drives one motor. You describe the motor once in a `SmartMotorControllerConfig` (its gearing, gains, limits and encoders), and a wrapper such as `TalonFXWrapper`, `SparkWrapper`, `NovaWrapper` or `A301Wrapper` applies it to the vendor's motor controller. The same config works on every supported motor controller.

New to YAMS? Read [How YAMS drives a motor](https://yams.yassrobotics.com/documentation/tutorials/how-yams-drives-a-motor.md) first. It explains the three layers (motor controller, mechanism, subsystem), the words rotor, mechanism and measurement, open and closed loop, and the units your gains are in.

## Where to go next

| You want to                                             | Read                                                                                                                                                                                                                                                                                                                   |
| ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Look up what an option does                             | [SmartMotorControllerConfig](https://yams.yassrobotics.com/documentation/reference/editor/config.md), one page per group of options                                                                                                                                                                                    |
| Check whether your motor controller supports an option  | [Motor controller feature matrix](https://yams.yassrobotics.com/documentation/reference/editor/feature-matrix.md)                                                                                                                                                                                                      |
| Set up followers, external encoders or a vendor config  | [Followers](https://yams.yassrobotics.com/documentation/reference/editor/config/followers.md), [Encoders](https://yams.yassrobotics.com/documentation/reference/editor/config/encoders.md), [`withVendorConfig`](https://yams.yassrobotics.com/documentation/reference/editor/config/motor-basics.md#withvendorconfig) |
| Keep settings already saved on the motor controller     | [`withResetPreviousConfig`](https://yams.yassrobotics.com/documentation/reference/editor/config/motor-basics.md#withresetpreviousconfig)                                                                                                                                                                               |
| Use different gains in simulation                       | [Simulation-only PID + feedforward](https://yams.yassrobotics.com/documentation/understanding/simulation-only-pid-+-feedforward.md)                                                                                                                                                                                    |
| Stop brownouts                                          | [Limiting power consumption](https://yams.yassrobotics.com/documentation/how-to-motor-controllers-and-sensors/limiting-power-consumption.md)                                                                                                                                                                           |
| Choose between a trapezoidal and an exponential profile | [Exponential profiles](https://yams.yassrobotics.com/documentation/understanding/exponential-profiles.md#when-to-use-each-profile-type)                                                                                                                                                                                |
| Replace PID with a model based controller               | [LQR controllers](https://yams.yassrobotics.com/documentation/understanding/lqr-controllers.md)                                                                                                                                                                                                                        |
| Find your gains                                         | [Live tuning](https://yams.yassrobotics.com/documentation/how-to-tuning/live-tuning.md)                                                                                                                                                                                                                                |

{% hint style="warning" %}
Not every option works on every motor controller. See [which options are not supported everywhere](https://yams.yassrobotics.com/documentation/reference/editor/config.md#not-every-option-works-on-every-motor-controller).
{% endhint %}

## Reach the vendor objects yourself

YAMS does not have an option for every vendor setting. For a setting it does not have, start from your own vendor config with [`withVendorConfig`](https://yams.yassrobotics.com/documentation/reference/editor/config/motor-basics.md#withvendorconfig). To call the vendor's API directly, fetch the vendor objects from the `SmartMotorController`. Both methods return `Object`, so cast to the class your wrapper holds:

```java
// A SparkWrapper around a SPARK Flex
SparkFlex sparkFlex = (SparkFlex) smartMotorController.getMotorController();
SparkFlexConfig sparkFlexConfig = (SparkFlexConfig) smartMotorController.getMotorControllerConfig();
```

## Motor options stay on the motor config

A mechanism config such as `ArmConfig` never changes the `SmartMotorControllerConfig`. Soft limits, the starting position, gearing and gains are always set on the motor config. [Mechanism configs](https://yams.yassrobotics.com/documentation/reference/mechanism-configs.md) lists what each mechanism config sets.

## Simulation without a mechanism

A mechanism class simulates its motor for you. A `SmartMotorController` used on its own needs `simIterate()` and `updateTelemetry()` called every loop: see [Running the simulation](https://yams.yassrobotics.com/documentation/reference/editor/config/simulation.md#running-the-simulation).

## Learn more about motors

{% embed url="<https://youtu.be/0BfR_viZSmQ>" %}

{% embed url="<https://youtu.be/pIKvQX5p1PE>" %}

The presentation from the video series continues onto PID, feedforward and motion profiles.

{% file src="/files/Zw793TT7TdZ666pgmjCw" %}

The WPILib docs explain PID and feedforward with interactive simulations: see [tuning a turret position controller](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/introduction/tuning-turret.html).


---

# 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/editor.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.
