[Draft]: Add LeRobot Data Handler for Dataset Export #41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a new LeRobot data handler that enables seamless export of EmbodiChain environment episodes to the LeRobot dataset format. This integration allows users to leverage LeRobot's powerful data visualization and training tools with EmbodiChain-generated robotic manipulation data.
Key Features
env.to_dataset()methodChanges Summary
New Files
embodichain/data/handler/lerobot_data_handler.py: Core handler implementationLerobotDataHandlerclass for data extraction and conversionsave_to_lerobot_format()function for easy episode savingModified Files
embodichain/data/enum.py:Modalityenum for data modality types (states, actions, images, etc.)JointTypeandEefTypeenums for robot data typesActionModeenum for absolute/relative action specificationsSUPPORTED_PROPRIO_TYPESandSUPPORTED_ACTION_TYPESconstants for data schemaHandQposNormalizerclass for dexterous hand joint normalization/denormalizationembodichain/lab/gym/envs/embodied_env.py:to_dataset()method toEmbodiedEnvclassembodichain/lab/scripts/run_env.py:env.to_dataset()after successful task completionembodichain/lab/gym/utils/misc.py:configs/gym/pour_water/gym_config.json:robot_metaconfiguration with observation and action specificationsUsage Example
Technical Details
Data Schema:
Format Compatibility:
Storage:
~/.cache/huggingface/lerobot/<repo_id>/HF_LEROBOT_HOMEenvironment variableDependencies
This feature requires the
lerobotpackage to be installed:The handler gracefully handles missing dependencies and provides clear error messages.
Type of change
Benefits
Checklist
black .command to format the code baseMigration Guide
For existing EmbodiChain users:
pip install lerobotpip install gymnasium==0.29.1robot_metaconfiguration with observation and action specificationsenv.to_dataset(repo_id="your/dataset")after episode completionlerobot-dataset-viz --repo-id your/dataset --episode-index 0No breaking changes to existing code - the feature is opt-in through the
to_dataset()method.