# 远程操作员

遥操作者生成供机器人执行的动作——例如主臂、游戏手柄、键盘或手机。它们都实现了`Teleoperator`接口，因此针对该接口编写的录制脚本可适用于任意输入设备。

请参阅 [手机遥操作](../phone_teleop) 和 [Isaac Teleop](../isaac_teleop) 了解设置指南，以及 [机器人模仿学习](../il_robots) 了解录制工作流。对于核心集之外的社区维护设备，请参阅 [第三方机器人与遥操作器](../third_party_robots)。若要添加您自己的遥操作器，请参阅 [使用您自己的硬件](../integrate_hardware)。

## 遥操作员[[lerobot.teleoperators.Teleoperator]]

#### lerobot.teleoperators.Teleoperator[[lerobot.teleoperators.Teleoperator]]

```python
lerobot.teleoperators.Teleoperator(config: TeleoperatorConfig)
```

[源代码](https://github.com/huggingface/lerobot/blob/v0.7.0/src/lerobot/teleoperators/teleoperator.py#L32)

**参数：**

config_class (RobotConfig)：此遥操作器的预期配置类。

name (str) : 用于标识此遥操作类型的唯一名称。

所有兼容 LeRobot 的遥操作设备的基础抽象类。

此类为与物理遥操作器交互提供了标准化接口。子类必须实现所有抽象方法和属性才能被使用。

#### 连接[[lerobot.teleoperators.Teleoperator.connect]]

```python
connect(calibrate: bool = True)
```

[源代码](https://github.com/huggingface/lerobot/blob/v0.7.0/src/lerobot/teleoperators/teleoperator.py#L125)

**参数：**

calibrate (bool) : 如果为 True，则在连接后，如果遥操作器未校准或需要校准，则自动对其进行校准（这取决于硬件）。

与遥操作员建立通信。

#### 断开连接[[lerobot.teleoperators.Teleoperator.disconnect]]

```python
disconnect()
```

[源代码](https://github.com/huggingface/lerobot/blob/v0.7.0/src/lerobot/teleoperators/teleoperator.py#L224)

断开与遥操作器的连接，并执行任何必要的清理工作。

#### 配置[[lerobot.teleoperators.Teleoperator.configure]]

```python
configure()
```

[源代码](https://github.com/huggingface/lerobot/blob/v0.7.0/src/lerobot/teleoperators/teleoperator.py#L190)

对遥操作器应用任何一次性或运行时配置。这可能包括设置电机参数、控制模式或初始状态。

#### 校准[[lerobot.teleoperators.Teleoperator.calibrate]]

```python
calibrate()
```

[源代码](https://github.com/huggingface/lerobot/blob/v0.7.0/src/lerobot/teleoperators/teleoperator.py#L142)

如有必要，请校准遥操作器。如果没有，此操作应为空操作。

此方法应收集任何必要的数据（例如，电机偏移量），并相应地更新 :pyattr:`calibration` 字典。

#### get_action[[lerobot.teleoperators.Teleoperator.get_action]]

```python
get_action()
```

[源代码](https://github.com/huggingface/lerobot/blob/v0.7.0/src/lerobot/teleoperators/teleoperator.py#L198)

**返回：** `RobotAction`

一个扁平字典，表示遥操作者当前的操作。其结构应与 :pymeth:`observation_features` 相匹配。

从遥操作员处获取当前操作。

#### send_feedback[[lerobot.teleoperators.Teleoperator.send_feedback]]

```python
send_feedback(feedback: dict)
```

[源代码](https://github.com/huggingface/lerobot/blob/v0.7.0/src/lerobot/teleoperators/teleoperator.py#L209)

**参数：**

feedback (dict[str, Any]) : 表示所需反馈的字典。其结构应与 :pymeth:`feedback_features` 相匹配。

**返回：** dict[str, Any]

实际发送到电机的动作，可能会经过裁剪或修改，例如通过速度安全限制。

向遥操作员发送反馈操作命令。

#### action_features[[lerobot.teleoperators.Teleoperator.action_features]]

```python
action_features()
```

[源代码](https://github.com/huggingface/lerobot/blob/v0.7.0/src/lerobot/teleoperators/teleoperator.py#L90)

一个字典，用于描述遥操作器生成的动作的结构和类型。其结构（键）应与 `get_action` 返回的内容的结构相匹配。字典的值应为对应值的类型；如果它是简单值，则例如，对于单个本体感觉值（关节的目标位置/速度），其类型为 `float`。

注意：无论机器人是否已连接，都应能够调用此属性。

#### feedback_features[[lerobot.teleoperators.Teleoperator.feedback_features]]

```python
feedback_features()
```

[源代码](https://github.com/huggingface/lerobot/blob/v0.7.0/src/lerobot/teleoperators/teleoperator.py#L103)

一个字典，用于描述机器人所期望的反馈动作的结构和类型。其结构（键）应与传递给 :pymeth:`send_feedback` 的内容的结构相匹配。如果值是简单值，则字典中的值应为该值的类型，例如，对于单个本体感觉值（关节的目标位置/速度），类型为 `float`

注意：无论机器人是否已连接，都应能够调用此属性。

#### is_connected[[lerobot.teleoperators.Teleoperator.is_connected]]

```python
is_connected()
```

[源代码](https://github.com/huggingface/lerobot/blob/v0.7.0/src/lerobot/teleoperators/teleoperator.py#L116)

遥操作者当前是否已连接。如果为 `False`，调用 :pymeth:`get_action` 或 :pymeth:`send_feedback` 时应抛出错误。

#### is_calibrated[[lerobot.teleoperators.Teleoperator.is_calibrated]]

```python
is_calibrated()
```

[源代码](https://github.com/huggingface/lerobot/blob/v0.7.0/src/lerobot/teleoperators/teleoperator.py#L136)

遥操作器当前是否已校准。如果不适用，则应始终为 `True`

## TeleoperatorConfig[[lerobot.teleoperators.TeleoperatorConfig]]

#### lerobot.teleoperators.TeleoperatorConfig[[lerobot.teleoperators.TeleoperatorConfig]]

```python
lerobot.teleoperators.TeleoperatorConfig(id: str | None = None, calibration_dir: pathlib.Path | None = None)
```

[源代码](https://github.com/huggingface/lerobot/blob/v0.7.0/src/lerobot/teleoperators/config.py#L23)

## make_teleoperator_from_config[[lerobot.teleoperators.make_teleoperator_from_config]]

#### lerobot.teleoperators.make_teleoperator_from_config[[lerobot.teleoperators.make_teleoperator_from_config]]

```python
lerobot.teleoperators.make_teleoperator_from_config(config: TeleoperatorConfig)
```

[源代码](https://github.com/huggingface/lerobot/blob/v0.7.0/src/lerobot/teleoperators/utils.py#L36)

