mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-18 10:10:08 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
committed by
Adil Zouitine
parent
ecda7482c7
commit
6d4e983197
@@ -158,13 +158,14 @@ LeRobot provides several specialized converter functions for common robotics sce
|
|||||||
```python
|
```python
|
||||||
from lerobot.processor.converters import (
|
from lerobot.processor.converters import (
|
||||||
to_transition_teleop_action,
|
to_transition_teleop_action,
|
||||||
to_transition_robot_observation,
|
to_transition_robot_observation,
|
||||||
to_output_robot_action,
|
to_output_robot_action,
|
||||||
to_dataset_frame
|
to_dataset_frame
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
**`to_transition_teleop_action`** - Converts teleoperation device actions to EnvTransitions:
|
**`to_transition_teleop_action`** - Converts teleoperation device actions to EnvTransitions:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# Use case: Phone, gamepad, or other teleop device control
|
# Use case: Phone, gamepad, or other teleop device control
|
||||||
phone_action = {"x": 0.1, "y": -0.2, "gripper": 0.8}
|
phone_action = {"x": 0.1, "y": -0.2, "gripper": 0.8}
|
||||||
@@ -173,6 +174,7 @@ transition = to_transition_teleop_action(phone_action)
|
|||||||
```
|
```
|
||||||
|
|
||||||
**`to_transition_robot_observation`** - Converts robot sensor data to EnvTransitions:
|
**`to_transition_robot_observation`** - Converts robot sensor data to EnvTransitions:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# Use case: Live robot observation during inference
|
# Use case: Live robot observation during inference
|
||||||
robot_obs = {
|
robot_obs = {
|
||||||
@@ -184,6 +186,7 @@ transition = to_transition_robot_observation(robot_obs)
|
|||||||
```
|
```
|
||||||
|
|
||||||
**`to_output_robot_action`** - Extracts robot-executable actions from EnvTransitions:
|
**`to_output_robot_action`** - Extracts robot-executable actions from EnvTransitions:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# Use case: Converting model outputs back to robot commands
|
# Use case: Converting model outputs back to robot commands
|
||||||
model_transition = {ACTION: {"action.joint_1": 0.2, "action.joint_2": 0.1}}
|
model_transition = {ACTION: {"action.joint_1": 0.2, "action.joint_2": 0.1}}
|
||||||
@@ -192,6 +195,7 @@ robot_action = to_output_robot_action(model_transition)
|
|||||||
```
|
```
|
||||||
|
|
||||||
**`to_dataset_frame`** - Converts transitions to dataset-compatible format:
|
**`to_dataset_frame`** - Converts transitions to dataset-compatible format:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# Use case: Saving processed data or creating training batches
|
# Use case: Saving processed data or creating training batches
|
||||||
features = {
|
features = {
|
||||||
@@ -213,7 +217,7 @@ phone_to_robot_ee_pose = RobotProcessor(
|
|||||||
to_output=lambda tr: tr # Keep as EnvTransition
|
to_output=lambda tr: tr # Keep as EnvTransition
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example from phone_so100_eval.py - Robot action execution
|
# Example from phone_so100_eval.py - Robot action execution
|
||||||
robot_ee_to_joints = RobotProcessor(
|
robot_ee_to_joints = RobotProcessor(
|
||||||
steps=[...],
|
steps=[...],
|
||||||
to_transition=lambda tr: tr, # Already EnvTransition
|
to_transition=lambda tr: tr, # Already EnvTransition
|
||||||
|
|||||||
Reference in New Issue
Block a user