> For the complete documentation index, see [llms.txt](https://docs.hello-robot.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hello-robot.com/stretch4-body-repo/teleoperation/primer_gamepad_teleop.md).

# Gamepad Teleop

## Gamepad Teleop for Stretch

Stretch 4 ships with a gamepad controller for teleoperation.

You can start the gamepad teleop script by running `stretch_gamepad_teleop` in the command line, or from the Stretch Tray icon in the system tray.

> Note: `stretch_gamepad_teleop` uses a RobotClient. Make sure the Stretch Body Server is running using `stretch_body_server --status`.

### Homing from Gamepad Teleop

When you boot Stretch 4, the robot needs to be homed (auto-calibrated). You may notice that the controller vibrates and does not allow you to move the robot. If this happens, make sure the robot's surroundings are clear, and press the `Start` button on the controller to Home (calibrate) the joints.

### Running in the background

You can keep the `stretch_gamepad_teleop` application script running in the background while you run other RobotClient applications. The `stretch_gamepad_teleop` script will timeout and stop sending commands to the server after a few milliseconds of not receiving inputs.&#x20;

> Note that `stretch_gamepad_teleop` has a higher priority on the RobotClient command queue, so commands from it will override other scripts by default.

### Controller Mappings

By default, `stretch_gamepad_teleop` has two control mapping modes that you can switch between using `Y`.&#x20;

The first is Joint Control, which allows you to control each joint individually.&#x20;

The second is Flying Gripper Control, which allows you to use the `Right Stick` to move the wrist, and move towards where the gripper is pointing using the `Left Stick`. This mode is useful for manipulation and grasping objects.

{% tabs %}
{% tab title="Joint Control Mode" %}

<figure><img src="https://3036606582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDaf9PbMu7SLXdrSHB2Te%2Fuploads%2FMbjW7d2zHDkoJ6TMzKLK%2Fimage.png?alt=media&amp;token=44d2f73d-f649-46e3-a750-233db1d28f3a" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Flying Gripper Mode" %}

<figure><img src="https://3036606582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDaf9PbMu7SLXdrSHB2Te%2Fuploads%2FVep3o1leEccXtzg4xbMp%2Fimage.png?alt=media&amp;token=faecd7f3-6e40-460c-891a-10734d744268" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

### Changing Speed and Strength

Tap or hold the `Right Trigger + A` to change or cycle the speed of Stretch 4. By default it is Medium speed. This cycles between Low, Medium and High speed presets.&#x20;

> Be careful when navigating with Medium or High speed. It is a good idea to keep the arm retracted or Stow the robot (Hold `Select`) while the robot is moving in the environment.

Tap or hold the `Right Trigger + B` to change or cycle the strength of Stretch 4. By default it is Medium strength. This cycles between Low, Medium and High strength presets. Use Low strength when manipulating the robot near people, and High strength when trying to manipulate objects that require more force, like opening a door.

> Strength affects the contact sensitivity thresholds. Low strength will stop joint motion when encountering a small motor effort.

### Special Functions

* **Homing**: If the robot is not homed, press the `Start` button to home the robot.
* **Gripper Handedness**: If the robot is homed, hold the `Start` button for 3 seconds to switch gripper handedness (Left/Right).
* **Stowing**: Hold the `Select` button for 3 seconds to stow the robot.

## Customization

You can customize the behavior by:

* Modifying `gamepad_control_mappings.py` to add or edit mappings.
* Setting `params['function_cmd']` in user parameters to execute a shell command via the `X` button.


---

# 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.hello-robot.com/stretch4-body-repo/teleoperation/primer_gamepad_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.
