> For the complete documentation index, see [llms.txt](https://docs.raidrobotics.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.raidrobotics.org/commands-v3-state-machine/guide/teleop.md).

# Driver controls

The driver's controls are in `opmodes/teleop/DriveTeleop.java`, listed on the Driver Station as **Teleop › Drive**. The driver uses one Xbox controller on port 0.

| Control              | Does                                                    |
| -------------------- | ------------------------------------------------------- |
| Left stick           | Drive (field-centric)                                   |
| Right stick (X)      | Turn                                                    |
| Left bumper          | Reset which way is "forward"                            |
| Right trigger (hold) | Intake a game piece                                     |
| Right bumper (hold)  | Score, once the robot is in position                    |
| View (back) button   | Stop trusting the Limelights; press again to trust them |

The simulator's keyboard keys for each are in [Controls](https://docs.raidrobotics.org/commands-v3-state-machine/reference/controls.md).

## Driving

The drivetrain's default command drives field-centric from the sticks:

{% code title="DriveTeleop.java" %}

```java
// Drive with the left stick, turn with the right stick
// (X is forward and Y is left in WPILib, so the sticks are negated)
drivetrain.setDefaultCommand(
    drivetrain.applyRequest("Drivetrain.FieldCentricDrive", () ->
        drive.withVelocityX(-controller.getLeftY() * robot.maxSpeed)
            .withVelocityY(-controller.getLeftX() * robot.maxSpeed)
            .withRotationalRate(-controller.getRightX() * robot.maxAngularRate)
    )
);
```

{% endcode %}

The stick values (−1 to 1) are scaled by `robot.maxSpeed` and `robot.maxAngularRate`. The request uses `OpenLoopVoltage`, which feels direct to the driver.

## The superstructure

Teleop starts the state machine, then binds buttons to **requests**:

{% code title="DriveTeleop.java" %}

```java
// The state machine runs the whole time teleop is enabled, and starts from IDLE
RobotModeTriggers.teleop().whileTrue(superstructure.createStateMachine());

// Hold to pick up a game piece
controller.rightTrigger().whileTrue(superstructure.requestIntake());

// Hold to score; the robot scores as soon as it's in position
controller.rightBumper().whileTrue(superstructure.requestScore());
```

{% endcode %}

Buttons never run a mechanism directly. Holding the right trigger only says "the driver wants to intake". The state machine decides what that means right now. See [Requests](https://docs.raidrobotics.org/commands-v3-state-machine/concepts/requests.md).

## Vision

```java
// Press to stop trusting the Limelights; press again to trust them
controller.view().toggleOnTrue(robot.vision.ignore());
```

For when a camera is clearly wrong in a match. See [Vision](https://docs.raidrobotics.org/commands-v3-state-machine/guide/vision.md#turning-vision-off).

## Rules for this file

* **Buttons only make requests.** They never run a mechanism directly.
* **One binding per line, with a plain-words comment right above it.** RAIDSystems shows that comment as the button's description on its Controls page, for the drive team to approve. Write it for a driver, not a programmer.
* **Keep the table in the class comment in step with the bindings.**

To add a button, see [Add a button](https://docs.raidrobotics.org/commands-v3-state-machine/how-to/add-a-button.md).

## A second controller

Add it to `Robot.java` next to the first one (keep the `new CommandXboxController(port)` shape: RAIDSystems reads it), add its port to `Constants.Controllers`, then bind its buttons in `DriveTeleop` the same way.


---

# 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://docs.raidrobotics.org/commands-v3-state-machine/guide/teleop.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.
