mit einem Klick
add-task-env
// Use when creating a new task environment for EmbodiChain, including expert demonstration tasks, RL tasks or any EmbodiedEnv subclass
// Use when creating a new task environment for EmbodiChain, including expert demonstration tasks, RL tasks or any EmbodiedEnv subclass
Use when adding a new observation, event, reward, action, dataset, or randomization functor to an EmbodiChain environment
Use when adding a new observation, event, reward, action, dataset, or randomization functor to an EmbodiChain environment
Use when writing tests for EmbodiChain modules, including observation functors, reward functors, solvers, sensors, environments, or any Python module
Write benchmark scripts for EmbodiChain modules following project conventions
Create a pull request for EmbodiChain following the project's PR template and conventions, including selecting proper GitHub repository labels
Use before committing or creating a PR for EmbodiChain to verify code style, headers, annotations, exports, and docstrings pass CI checks
| name | add-task-env |
| description | Use when creating a new task environment for EmbodiChain, including expert demonstration tasks, RL tasks or any EmbodiedEnv subclass |
Scaffold a new task environment following EmbodiChain's conventions and patterns.
Ask the user:
tableware, rl, or special (maps to embodichain/lab/gym/envs/tasks/<category>/)pick_place)PickPlace-v1)create_demo_action_list)Place at embodichain/lab/gym/envs/tasks/<category>/<name>.py.
Template:
# ----------------------------------------------------------------------------
# Copyright (c) 2021-2026 DexForce Technology Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------
from __future__ import annotations
import torch
from typing import Dict, Any, Tuple
from embodichain.lab.gym.utils.registration import register_env
from embodichain.lab.gym.envs import EmbodiedEnv, EmbodiedEnvCfg
from embodichain.lab.sim.types import EnvObs
__all__ = ["<CamelCaseName>Env"]
@register_env("<GymId>")
class <CamelCaseName>Env(EmbodiedEnv):
"""<One-line description of the task>.
<Longer description of what the task involves and its reward structure.>
"""
def __init__(self, cfg: EmbodiedEnvCfg = None, **kwargs):
if cfg is None:
cfg = EmbodiedEnvCfg()
super().__init__(cfg, **kwargs)
# Expert demo tasks: implement `create_demo_action_list`.
# RL tasks: implement `check_truncated`, `get_reward`, `compute_task_state`.
Add to embodichain/lab/gym/envs/tasks/__init__.py:
from embodichain.lab.gym.envs.tasks.<category>.<name> import <CamelCaseName>Env
Add "<CamelCaseName>Env" to the __all__ list.
Place at tests/gym/envs/tasks/test_<name>.py.
black embodichain/lab/gym/envs/tasks/<category>/<name>.py
black tests/gym/envs/tasks/test_<name>.py
from __future__ import annotations@register_env decorator with unique gym ID__all__ defined in the task modulecfg = EmbodiedEnvCfg() in __init____all__ added to tasks/__init__.pyblack run on both files