> For the complete documentation index, see [llms.txt](https://yagsl.yassrobotics.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yagsl.yassrobotics.com/reference/json-schema/swervedrive-json.md).

# swervedrive.json

Top-level drive configuration. Parsed into `swervelib.parser.json.SwerveDriveJson`.

```json
{
  "gyro": {
    "type": "pigeon2_can",
    "id": 0,
    "canbus": ""
  },
  "gyroAxis": "yaw",
  "gyroInvert": false,
  "modules": ["frontleft.json", "frontright.json", "backleft.json", "backright.json"]
}
```

| Field        | Type                                                  | Required             | Description                                                                                                                             |
| ------------ | ----------------------------------------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| `gyro`       | [Device](/reference/json-schema/device-types.md#gyro) | yes                  | The robot's gyroscope. See [Device type strings](/reference/json-schema/device-types.md#gyro) for valid `type` values.                  |
| `gyroAxis`   | string enum                                           | no (default `"yaw"`) | Which physical axis of the gyro to use for robot heading: `yaw`, `pitch`, or `roll`.                                                    |
| `gyroInvert` | boolean                                               | yes                  | Invert the gyroscope's heading reading.                                                                                                 |
| `modules`    | string\[]                                             | yes                  | Filenames (relative to the `modules/` directory) of each module's JSON file, minimum 3, listed clockwise from front-left by convention. |

## `gyro` object

| Field    | Type   | Description                                                                                                                                                                                                                              |
| -------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type`   | string | Gyro type string — see [Device type strings](/reference/json-schema/device-types.md#gyro). Set to `custom` to skip YAGSL's gyro setup and configure the gyro yourself; see [Custom Gyro](/reference/hardware/gyroscopes.md#custom-gyro). |
| `id`     | number | CAN ID. Set to `0` if the gyro doesn't need one.                                                                                                                                                                                         |
| `canbus` | string | CAN bus name the gyro is on. `""` for the default (rio) bus.                                                                                                                                                                             |

{% hint style="info" %}
When `gyro.type` is `custom`, `gyroAxis` and `gyroInvert` above are also ignored — the parser never calls `SwerveDriveConfig.withGyro()`/`withGyroInverted()`, so you must call them yourself.
{% endhint %}


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://yagsl.yassrobotics.com/reference/json-schema/swervedrive-json.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
