Upload folder using huggingface_hub
Browse files- README.md +24 -3
- configs.py +489 -0
- env.py +1 -0
- requirements.txt +2 -2
README.md
CHANGED
|
@@ -1,18 +1,39 @@
|
|
| 1 |
## RoboCasa365 Env Installation _ Lerobot
|
| 2 |
|
| 3 |
```bash
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
```
|
| 7 |
|
| 8 |
```bash
|
| 9 |
-
git clone https://github.com/ARISE-Initiative/robosuite
|
| 10 |
cd robosuite
|
| 11 |
pip install -e .
|
| 12 |
```
|
| 13 |
```bash
|
| 14 |
cd ..
|
| 15 |
-
git clone https://github.com/robocasa/robocasa
|
| 16 |
cd robocasa
|
| 17 |
pip install -e .
|
| 18 |
```
|
|
|
|
| 1 |
## RoboCasa365 Env Installation _ Lerobot
|
| 2 |
|
| 3 |
```bash
|
| 4 |
+
cd robosuite
|
| 5 |
+
pip install -e .
|
| 6 |
+
|
| 7 |
+
cd ..
|
| 8 |
+
cd robocasa
|
| 9 |
+
pip install -e .
|
| 10 |
+
|
| 11 |
+
python -m robocasa.scripts.setup_macros
|
| 12 |
+
python -m robocasa.scripts.download_kitchen_assets
|
| 13 |
+
|
| 14 |
+
```
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
---
|
| 24 |
+
```bash
|
| 25 |
+
#git clone https://huggingface.co/Whalswp/RoboCasa_Env
|
| 26 |
|
| 27 |
```
|
| 28 |
|
| 29 |
```bash
|
| 30 |
+
#git clone https://github.com/ARISE-Initiative/robosuite
|
| 31 |
cd robosuite
|
| 32 |
pip install -e .
|
| 33 |
```
|
| 34 |
```bash
|
| 35 |
cd ..
|
| 36 |
+
#git clone https://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+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
|
| 15 |
+
import abc
|
| 16 |
+
from dataclasses import dataclass, field, fields
|
| 17 |
+
from typing import Any
|
| 18 |
+
|
| 19 |
+
import draccus
|
| 20 |
+
|
| 21 |
+
from lerobot.configs.types import FeatureType, PolicyFeature
|
| 22 |
+
from lerobot.robots import RobotConfig
|
| 23 |
+
from lerobot.teleoperators.config import TeleoperatorConfig
|
| 24 |
+
from lerobot.utils.constants import (
|
| 25 |
+
ACTION,
|
| 26 |
+
LIBERO_KEY_EEF_MAT,
|
| 27 |
+
LIBERO_KEY_EEF_POS,
|
| 28 |
+
LIBERO_KEY_EEF_QUAT,
|
| 29 |
+
LIBERO_KEY_GRIPPER_QPOS,
|
| 30 |
+
LIBERO_KEY_GRIPPER_QVEL,
|
| 31 |
+
LIBERO_KEY_JOINTS_POS,
|
| 32 |
+
LIBERO_KEY_JOINTS_VEL,
|
| 33 |
+
LIBERO_KEY_PIXELS_AGENTVIEW,
|
| 34 |
+
LIBERO_KEY_PIXELS_EYE_IN_HAND,
|
| 35 |
+
OBS_ENV_STATE,
|
| 36 |
+
OBS_IMAGE,
|
| 37 |
+
OBS_IMAGES,
|
| 38 |
+
OBS_STATE,
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
@dataclass
|
| 43 |
+
class EnvConfig(draccus.ChoiceRegistry, abc.ABC):
|
| 44 |
+
task: str | None = None
|
| 45 |
+
fps: int = 30
|
| 46 |
+
features: dict[str, PolicyFeature] = field(default_factory=dict)
|
| 47 |
+
features_map: dict[str, str] = field(default_factory=dict)
|
| 48 |
+
max_parallel_tasks: int = 1
|
| 49 |
+
disable_env_checker: bool = True
|
| 50 |
+
|
| 51 |
+
@property
|
| 52 |
+
def type(self) -> str:
|
| 53 |
+
return self.get_choice_name(self.__class__)
|
| 54 |
+
|
| 55 |
+
@property
|
| 56 |
+
def package_name(self) -> str:
|
| 57 |
+
"""Package name to import if environment not found in gym registry"""
|
| 58 |
+
return f"gym_{self.type}"
|
| 59 |
+
|
| 60 |
+
@property
|
| 61 |
+
def gym_id(self) -> str:
|
| 62 |
+
"""ID string used in gym.make() to instantiate the environment"""
|
| 63 |
+
return f"{self.package_name}/{self.task}"
|
| 64 |
+
|
| 65 |
+
@property
|
| 66 |
+
@abc.abstractmethod
|
| 67 |
+
def gym_kwargs(self) -> dict:
|
| 68 |
+
raise NotImplementedError()
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
@dataclass
|
| 72 |
+
class HubEnvConfig(EnvConfig):
|
| 73 |
+
"""Base class for environments that delegate creation to a hub-hosted make_env.
|
| 74 |
+
|
| 75 |
+
Hub environments download and execute remote code from the HF Hub.
|
| 76 |
+
The hub_path points to a repository containing an env.py with a make_env function.
|
| 77 |
+
"""
|
| 78 |
+
|
| 79 |
+
hub_path: str | None = None # required: e.g., "username/repo" or "username/repo@branch:file.py"
|
| 80 |
+
|
| 81 |
+
@property
|
| 82 |
+
def gym_kwargs(self) -> dict:
|
| 83 |
+
# Not used for hub environments - the hub's make_env handles everything
|
| 84 |
+
return {}
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
@EnvConfig.register_subclass("aloha")
|
| 88 |
+
@dataclass
|
| 89 |
+
class AlohaEnv(EnvConfig):
|
| 90 |
+
task: str | None = "AlohaInsertion-v0"
|
| 91 |
+
fps: int = 50
|
| 92 |
+
episode_length: int = 400
|
| 93 |
+
obs_type: str = "pixels_agent_pos"
|
| 94 |
+
observation_height: int = 480
|
| 95 |
+
observation_width: int = 640
|
| 96 |
+
render_mode: str = "rgb_array"
|
| 97 |
+
features: dict[str, PolicyFeature] = field(
|
| 98 |
+
default_factory=lambda: {
|
| 99 |
+
ACTION: PolicyFeature(type=FeatureType.ACTION, shape=(14,)),
|
| 100 |
+
}
|
| 101 |
+
)
|
| 102 |
+
features_map: dict[str, str] = field(
|
| 103 |
+
default_factory=lambda: {
|
| 104 |
+
ACTION: ACTION,
|
| 105 |
+
"agent_pos": OBS_STATE,
|
| 106 |
+
"top": f"{OBS_IMAGE}.top",
|
| 107 |
+
"pixels/top": f"{OBS_IMAGES}.top",
|
| 108 |
+
}
|
| 109 |
+
)
|
| 110 |
+
|
| 111 |
+
def __post_init__(self):
|
| 112 |
+
if self.obs_type == "pixels":
|
| 113 |
+
self.features["top"] = PolicyFeature(
|
| 114 |
+
type=FeatureType.VISUAL, shape=(self.observation_height, self.observation_width, 3)
|
| 115 |
+
)
|
| 116 |
+
elif self.obs_type == "pixels_agent_pos":
|
| 117 |
+
self.features["agent_pos"] = PolicyFeature(type=FeatureType.STATE, shape=(14,))
|
| 118 |
+
self.features["pixels/top"] = PolicyFeature(
|
| 119 |
+
type=FeatureType.VISUAL, shape=(self.observation_height, self.observation_width, 3)
|
| 120 |
+
)
|
| 121 |
+
|
| 122 |
+
@property
|
| 123 |
+
def gym_kwargs(self) -> dict:
|
| 124 |
+
return {
|
| 125 |
+
"obs_type": self.obs_type,
|
| 126 |
+
"render_mode": self.render_mode,
|
| 127 |
+
"max_episode_steps": self.episode_length,
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
@EnvConfig.register_subclass("pusht")
|
| 132 |
+
@dataclass
|
| 133 |
+
class PushtEnv(EnvConfig):
|
| 134 |
+
task: str | None = "PushT-v0"
|
| 135 |
+
fps: int = 10
|
| 136 |
+
episode_length: int = 300
|
| 137 |
+
obs_type: str = "pixels_agent_pos"
|
| 138 |
+
render_mode: str = "rgb_array"
|
| 139 |
+
visualization_width: int = 384
|
| 140 |
+
visualization_height: int = 384
|
| 141 |
+
observation_height: int = 384
|
| 142 |
+
observation_width: int = 384
|
| 143 |
+
features: dict[str, PolicyFeature] = field(
|
| 144 |
+
default_factory=lambda: {
|
| 145 |
+
ACTION: PolicyFeature(type=FeatureType.ACTION, shape=(2,)),
|
| 146 |
+
"agent_pos": PolicyFeature(type=FeatureType.STATE, shape=(2,)),
|
| 147 |
+
}
|
| 148 |
+
)
|
| 149 |
+
features_map: dict[str, str] = field(
|
| 150 |
+
default_factory=lambda: {
|
| 151 |
+
ACTION: ACTION,
|
| 152 |
+
"agent_pos": OBS_STATE,
|
| 153 |
+
"environment_state": OBS_ENV_STATE,
|
| 154 |
+
"pixels": OBS_IMAGE,
|
| 155 |
+
}
|
| 156 |
+
)
|
| 157 |
+
|
| 158 |
+
def __post_init__(self):
|
| 159 |
+
if self.obs_type == "pixels_agent_pos":
|
| 160 |
+
self.features["pixels"] = PolicyFeature(
|
| 161 |
+
type=FeatureType.VISUAL, shape=(self.observation_height, self.observation_width, 3)
|
| 162 |
+
)
|
| 163 |
+
elif self.obs_type == "environment_state_agent_pos":
|
| 164 |
+
self.features["environment_state"] = PolicyFeature(type=FeatureType.ENV, shape=(16,))
|
| 165 |
+
|
| 166 |
+
@property
|
| 167 |
+
def gym_kwargs(self) -> dict:
|
| 168 |
+
return {
|
| 169 |
+
"obs_type": self.obs_type,
|
| 170 |
+
"render_mode": self.render_mode,
|
| 171 |
+
"visualization_width": self.visualization_width,
|
| 172 |
+
"visualization_height": self.visualization_height,
|
| 173 |
+
"max_episode_steps": self.episode_length,
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
@dataclass
|
| 178 |
+
class ImagePreprocessingConfig:
|
| 179 |
+
crop_params_dict: dict[str, tuple[int, int, int, int]] | None = None
|
| 180 |
+
resize_size: tuple[int, int] | None = None
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
@dataclass
|
| 184 |
+
class RewardClassifierConfig:
|
| 185 |
+
"""Configuration for reward classification."""
|
| 186 |
+
|
| 187 |
+
pretrained_path: str | None = None
|
| 188 |
+
success_threshold: float = 0.5
|
| 189 |
+
success_reward: float = 1.0
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
@dataclass
|
| 193 |
+
class InverseKinematicsConfig:
|
| 194 |
+
"""Configuration for inverse kinematics processing."""
|
| 195 |
+
|
| 196 |
+
urdf_path: str | None = None
|
| 197 |
+
target_frame_name: str | None = None
|
| 198 |
+
end_effector_bounds: dict[str, list[float]] | None = None
|
| 199 |
+
end_effector_step_sizes: dict[str, float] | None = None
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
@dataclass
|
| 203 |
+
class ObservationConfig:
|
| 204 |
+
"""Configuration for observation processing."""
|
| 205 |
+
|
| 206 |
+
add_joint_velocity_to_observation: bool = False
|
| 207 |
+
add_current_to_observation: bool = False
|
| 208 |
+
add_ee_pose_to_observation: bool = False
|
| 209 |
+
display_cameras: bool = False
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
@dataclass
|
| 213 |
+
class GripperConfig:
|
| 214 |
+
"""Configuration for gripper control and penalties."""
|
| 215 |
+
|
| 216 |
+
use_gripper: bool = True
|
| 217 |
+
gripper_penalty: float = 0.0
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
@dataclass
|
| 221 |
+
class ResetConfig:
|
| 222 |
+
"""Configuration for environment reset behavior."""
|
| 223 |
+
|
| 224 |
+
fixed_reset_joint_positions: Any | None = None
|
| 225 |
+
reset_time_s: float = 5.0
|
| 226 |
+
control_time_s: float = 20.0
|
| 227 |
+
terminate_on_success: bool = True
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
@dataclass
|
| 231 |
+
class HILSerlProcessorConfig:
|
| 232 |
+
"""Configuration for environment processing pipeline."""
|
| 233 |
+
|
| 234 |
+
control_mode: str = "gamepad"
|
| 235 |
+
observation: ObservationConfig | None = None
|
| 236 |
+
image_preprocessing: ImagePreprocessingConfig | None = None
|
| 237 |
+
gripper: GripperConfig | None = None
|
| 238 |
+
reset: ResetConfig | None = None
|
| 239 |
+
inverse_kinematics: InverseKinematicsConfig | None = None
|
| 240 |
+
reward_classifier: RewardClassifierConfig | None = None
|
| 241 |
+
max_gripper_pos: float | None = 100.0
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
@EnvConfig.register_subclass(name="gym_manipulator")
|
| 245 |
+
@dataclass
|
| 246 |
+
class HILSerlRobotEnvConfig(EnvConfig):
|
| 247 |
+
"""Configuration for the HILSerlRobotEnv environment."""
|
| 248 |
+
|
| 249 |
+
robot: RobotConfig | None = None
|
| 250 |
+
teleop: TeleoperatorConfig | None = None
|
| 251 |
+
processor: HILSerlProcessorConfig = field(default_factory=HILSerlProcessorConfig)
|
| 252 |
+
|
| 253 |
+
name: str = "real_robot"
|
| 254 |
+
|
| 255 |
+
@property
|
| 256 |
+
def gym_kwargs(self) -> dict:
|
| 257 |
+
return {}
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
@EnvConfig.register_subclass("libero")
|
| 261 |
+
@dataclass
|
| 262 |
+
class LiberoEnv(EnvConfig):
|
| 263 |
+
task: str = "libero_10" # can also choose libero_spatial, libero_object, etc.
|
| 264 |
+
task_ids: list[int] | None = None
|
| 265 |
+
fps: int = 30
|
| 266 |
+
episode_length: int | None = None
|
| 267 |
+
obs_type: str = "pixels_agent_pos"
|
| 268 |
+
render_mode: str = "rgb_array"
|
| 269 |
+
camera_name: str = "agentview_image,robot0_eye_in_hand_image"
|
| 270 |
+
init_states: bool = True
|
| 271 |
+
camera_name_mapping: dict[str, str] | None = None
|
| 272 |
+
observation_height: int = 360
|
| 273 |
+
observation_width: int = 360
|
| 274 |
+
features: dict[str, PolicyFeature] = field(
|
| 275 |
+
default_factory=lambda: {
|
| 276 |
+
ACTION: PolicyFeature(type=FeatureType.ACTION, shape=(7,)),
|
| 277 |
+
}
|
| 278 |
+
)
|
| 279 |
+
features_map: dict[str, str] = field(
|
| 280 |
+
default_factory=lambda: {
|
| 281 |
+
ACTION: ACTION,
|
| 282 |
+
LIBERO_KEY_EEF_POS: f"{OBS_STATE}.eef_pos",
|
| 283 |
+
LIBERO_KEY_EEF_QUAT: f"{OBS_STATE}.eef_quat",
|
| 284 |
+
LIBERO_KEY_EEF_MAT: f"{OBS_STATE}.eef_mat",
|
| 285 |
+
LIBERO_KEY_GRIPPER_QPOS: f"{OBS_STATE}.gripper_qpos",
|
| 286 |
+
LIBERO_KEY_GRIPPER_QVEL: f"{OBS_STATE}.gripper_qvel",
|
| 287 |
+
LIBERO_KEY_JOINTS_POS: f"{OBS_STATE}.joint_pos",
|
| 288 |
+
LIBERO_KEY_JOINTS_VEL: f"{OBS_STATE}.joint_vel",
|
| 289 |
+
LIBERO_KEY_PIXELS_AGENTVIEW: f"{OBS_IMAGES}.image",
|
| 290 |
+
LIBERO_KEY_PIXELS_EYE_IN_HAND: f"{OBS_IMAGES}.image2",
|
| 291 |
+
}
|
| 292 |
+
)
|
| 293 |
+
control_mode: str = "relative" # or "absolute"
|
| 294 |
+
|
| 295 |
+
def __post_init__(self):
|
| 296 |
+
if self.obs_type == "pixels":
|
| 297 |
+
self.features[LIBERO_KEY_PIXELS_AGENTVIEW] = PolicyFeature(
|
| 298 |
+
type=FeatureType.VISUAL, shape=(self.observation_height, self.observation_width, 3)
|
| 299 |
+
)
|
| 300 |
+
self.features[LIBERO_KEY_PIXELS_EYE_IN_HAND] = PolicyFeature(
|
| 301 |
+
type=FeatureType.VISUAL, shape=(self.observation_height, self.observation_width, 3)
|
| 302 |
+
)
|
| 303 |
+
elif self.obs_type == "pixels_agent_pos":
|
| 304 |
+
self.features[LIBERO_KEY_PIXELS_AGENTVIEW] = PolicyFeature(
|
| 305 |
+
type=FeatureType.VISUAL, shape=(self.observation_height, self.observation_width, 3)
|
| 306 |
+
)
|
| 307 |
+
self.features[LIBERO_KEY_PIXELS_EYE_IN_HAND] = PolicyFeature(
|
| 308 |
+
type=FeatureType.VISUAL, shape=(self.observation_height, self.observation_width, 3)
|
| 309 |
+
)
|
| 310 |
+
self.features[LIBERO_KEY_EEF_POS] = PolicyFeature(
|
| 311 |
+
type=FeatureType.STATE,
|
| 312 |
+
shape=(3,),
|
| 313 |
+
)
|
| 314 |
+
self.features[LIBERO_KEY_EEF_QUAT] = PolicyFeature(
|
| 315 |
+
type=FeatureType.STATE,
|
| 316 |
+
shape=(4,),
|
| 317 |
+
)
|
| 318 |
+
self.features[LIBERO_KEY_EEF_MAT] = PolicyFeature(
|
| 319 |
+
type=FeatureType.STATE,
|
| 320 |
+
shape=(3, 3),
|
| 321 |
+
)
|
| 322 |
+
self.features[LIBERO_KEY_GRIPPER_QPOS] = PolicyFeature(
|
| 323 |
+
type=FeatureType.STATE,
|
| 324 |
+
shape=(2,),
|
| 325 |
+
)
|
| 326 |
+
self.features[LIBERO_KEY_GRIPPER_QVEL] = PolicyFeature(
|
| 327 |
+
type=FeatureType.STATE,
|
| 328 |
+
shape=(2,),
|
| 329 |
+
)
|
| 330 |
+
self.features[LIBERO_KEY_JOINTS_POS] = PolicyFeature(
|
| 331 |
+
type=FeatureType.STATE,
|
| 332 |
+
shape=(7,),
|
| 333 |
+
)
|
| 334 |
+
self.features[LIBERO_KEY_JOINTS_VEL] = PolicyFeature(
|
| 335 |
+
type=FeatureType.STATE,
|
| 336 |
+
shape=(7,),
|
| 337 |
+
)
|
| 338 |
+
else:
|
| 339 |
+
raise ValueError(f"Unsupported obs_type: {self.obs_type}")
|
| 340 |
+
|
| 341 |
+
@property
|
| 342 |
+
def gym_kwargs(self) -> dict:
|
| 343 |
+
kwargs: dict[str, Any] = {"obs_type": self.obs_type, "render_mode": self.render_mode}
|
| 344 |
+
if self.task_ids is not None:
|
| 345 |
+
kwargs["task_ids"] = self.task_ids
|
| 346 |
+
return kwargs
|
| 347 |
+
|
| 348 |
+
|
| 349 |
+
@EnvConfig.register_subclass("metaworld")
|
| 350 |
+
@dataclass
|
| 351 |
+
class MetaworldEnv(EnvConfig):
|
| 352 |
+
task: str = "metaworld-push-v2" # add all tasks
|
| 353 |
+
fps: int = 80
|
| 354 |
+
episode_length: int = 400
|
| 355 |
+
obs_type: str = "pixels_agent_pos"
|
| 356 |
+
render_mode: str = "rgb_array"
|
| 357 |
+
multitask_eval: bool = True
|
| 358 |
+
features: dict[str, PolicyFeature] = field(
|
| 359 |
+
default_factory=lambda: {
|
| 360 |
+
"action": PolicyFeature(type=FeatureType.ACTION, shape=(4,)),
|
| 361 |
+
}
|
| 362 |
+
)
|
| 363 |
+
features_map: dict[str, str] = field(
|
| 364 |
+
default_factory=lambda: {
|
| 365 |
+
"action": ACTION,
|
| 366 |
+
"agent_pos": OBS_STATE,
|
| 367 |
+
"top": f"{OBS_IMAGE}",
|
| 368 |
+
"pixels/top": f"{OBS_IMAGE}",
|
| 369 |
+
}
|
| 370 |
+
)
|
| 371 |
+
|
| 372 |
+
def __post_init__(self):
|
| 373 |
+
if self.obs_type == "pixels":
|
| 374 |
+
self.features["top"] = PolicyFeature(type=FeatureType.VISUAL, shape=(480, 480, 3))
|
| 375 |
+
|
| 376 |
+
elif self.obs_type == "pixels_agent_pos":
|
| 377 |
+
self.features["agent_pos"] = PolicyFeature(type=FeatureType.STATE, shape=(4,))
|
| 378 |
+
self.features["pixels/top"] = PolicyFeature(type=FeatureType.VISUAL, shape=(480, 480, 3))
|
| 379 |
+
|
| 380 |
+
else:
|
| 381 |
+
raise ValueError(f"Unsupported obs_type: {self.obs_type}")
|
| 382 |
+
|
| 383 |
+
@property
|
| 384 |
+
def gym_kwargs(self) -> dict:
|
| 385 |
+
return {
|
| 386 |
+
"obs_type": self.obs_type,
|
| 387 |
+
"render_mode": self.render_mode,
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
|
| 391 |
+
@EnvConfig.register_subclass("isaaclab_arena")
|
| 392 |
+
@dataclass
|
| 393 |
+
class IsaaclabArenaEnv(HubEnvConfig):
|
| 394 |
+
hub_path: str = "nvidia/isaaclab-arena-envs"
|
| 395 |
+
episode_length: int = 300
|
| 396 |
+
num_envs: int = 1
|
| 397 |
+
embodiment: str | None = "gr1_pink"
|
| 398 |
+
object: str | None = "power_drill"
|
| 399 |
+
mimic: bool = False
|
| 400 |
+
teleop_device: str | None = None
|
| 401 |
+
seed: int | None = 42
|
| 402 |
+
device: str | None = "cuda:0"
|
| 403 |
+
disable_fabric: bool = False
|
| 404 |
+
enable_cameras: bool = False
|
| 405 |
+
headless: bool = False
|
| 406 |
+
enable_pinocchio: bool = True
|
| 407 |
+
environment: str | None = "gr1_microwave"
|
| 408 |
+
task: str | None = "Reach out to the microwave and open it."
|
| 409 |
+
state_dim: int = 54
|
| 410 |
+
action_dim: int = 36
|
| 411 |
+
camera_height: int = 512
|
| 412 |
+
camera_width: int = 512
|
| 413 |
+
video: bool = False
|
| 414 |
+
video_length: int = 100
|
| 415 |
+
video_interval: int = 200
|
| 416 |
+
# Comma-separated keys, e.g., "robot_joint_pos,left_eef_pos"
|
| 417 |
+
state_keys: str = "robot_joint_pos"
|
| 418 |
+
# Comma-separated keys, e.g., "robot_pov_cam_rgb,front_cam_rgb"
|
| 419 |
+
# Set to None or "" for environments without cameras
|
| 420 |
+
camera_keys: str | None = None
|
| 421 |
+
features: dict[str, PolicyFeature] = field(default_factory=dict)
|
| 422 |
+
features_map: dict[str, str] = field(default_factory=dict)
|
| 423 |
+
kwargs: dict | None = None
|
| 424 |
+
|
| 425 |
+
def __post_init__(self):
|
| 426 |
+
if self.kwargs:
|
| 427 |
+
# dynamically convert kwargs to fields in the dataclass
|
| 428 |
+
# NOTE! the new fields will not bee seen by the dataclass repr
|
| 429 |
+
field_names = {f.name for f in fields(self)}
|
| 430 |
+
for key, value in self.kwargs.items():
|
| 431 |
+
if key not in field_names and key != "kwargs":
|
| 432 |
+
setattr(self, key, value)
|
| 433 |
+
self.kwargs = None
|
| 434 |
+
|
| 435 |
+
# Set action feature
|
| 436 |
+
self.features[ACTION] = PolicyFeature(type=FeatureType.ACTION, shape=(self.action_dim,))
|
| 437 |
+
self.features_map[ACTION] = ACTION
|
| 438 |
+
|
| 439 |
+
# Set state feature
|
| 440 |
+
self.features[OBS_STATE] = PolicyFeature(type=FeatureType.STATE, shape=(self.state_dim,))
|
| 441 |
+
self.features_map[OBS_STATE] = OBS_STATE
|
| 442 |
+
|
| 443 |
+
# Add camera features for each camera key
|
| 444 |
+
if self.enable_cameras and self.camera_keys:
|
| 445 |
+
for cam_key in self.camera_keys.split(","):
|
| 446 |
+
cam_key = cam_key.strip()
|
| 447 |
+
if cam_key:
|
| 448 |
+
self.features[cam_key] = PolicyFeature(
|
| 449 |
+
type=FeatureType.VISUAL,
|
| 450 |
+
shape=(self.camera_height, self.camera_width, 3),
|
| 451 |
+
)
|
| 452 |
+
self.features_map[cam_key] = f"{OBS_IMAGES}.{cam_key}"
|
| 453 |
+
|
| 454 |
+
@property
|
| 455 |
+
def gym_kwargs(self) -> dict:
|
| 456 |
+
return {}
|
| 457 |
+
|
| 458 |
+
|
| 459 |
+
# ------------------------ Robocasa365 --------------------------------
|
| 460 |
+
|
| 461 |
+
@EnvConfig.register_subclass("robocasa")
|
| 462 |
+
@dataclass
|
| 463 |
+
class RoboCasaEnv(HubEnvConfig):
|
| 464 |
+
|
| 465 |
+
hub_path: str = "Whalswp/RoboCasa_Env"
|
| 466 |
+
|
| 467 |
+
task: str | None = None
|
| 468 |
+
obs_type: str = "pixels_agent_pos"
|
| 469 |
+
render_mode: str = "rgb_array"
|
| 470 |
+
camera_name: str = "robot0_agentview_left,robot0_eye_in_hand,robot0_agentview_right"
|
| 471 |
+
observation_height: int = 256
|
| 472 |
+
observation_width: int = 256
|
| 473 |
+
split: str | None = None
|
| 474 |
+
|
| 475 |
+
# VLA ๋ชจ๋ธ ๋ฑ์์ ์ฌ์ฉํ Observation & Action ๊ท๊ฒฉ ๋งคํ
|
| 476 |
+
features: dict[str, PolicyFeature] = field(default_factory=lambda: {
|
| 477 |
+
ACTION: PolicyFeature(type=FeatureType.ACTION, shape=(12,)),
|
| 478 |
+
"agent_pos": PolicyFeature(type=FeatureType.STATE, shape=(16,)),
|
| 479 |
+
"pixels/robot0_agentview_left": PolicyFeature(type=FeatureType.VISUAL, shape=(256, 256, 3)),
|
| 480 |
+
"pixels/robot0_agentview_right": PolicyFeature(type=FeatureType.VISUAL, shape=(256, 256, 3)),
|
| 481 |
+
"pixels/robot0_eye_in_hand": PolicyFeature(type=FeatureType.VISUAL, shape=(256, 256, 3)),
|
| 482 |
+
})
|
| 483 |
+
features_map: dict[str, str] = field(default_factory=lambda: {
|
| 484 |
+
ACTION: ACTION,
|
| 485 |
+
"agent_pos": OBS_STATE,
|
| 486 |
+
"pixels/robot0_agentview_left": f"{OBS_IMAGES}.robot0_agentview_left",
|
| 487 |
+
"pixels/robot0_agentview_right": f"{OBS_IMAGES}.robot0_agentview_right",
|
| 488 |
+
"pixels/robot0_eye_in_hand": f"{OBS_IMAGES}.robot0_eye_in_hand",
|
| 489 |
+
})
|
env.py
CHANGED
|
@@ -196,6 +196,7 @@ def make_env(n_envs: int = 1, use_async_envs: bool = False, cfg=None) -> dict[st
|
|
| 196 |
gym_kwargs["split"] = "target" if task_name in TARGET_TASKS else "pretrain"
|
| 197 |
else:
|
| 198 |
task_names = [t.strip() for t in task_name.split(",")]
|
|
|
|
| 199 |
|
| 200 |
out = defaultdict(dict)
|
| 201 |
|
|
|
|
| 196 |
gym_kwargs["split"] = "target" if task_name in TARGET_TASKS else "pretrain"
|
| 197 |
else:
|
| 198 |
task_names = [t.strip() for t in task_name.split(",")]
|
| 199 |
+
|
| 200 |
|
| 201 |
out = defaultdict(dict)
|
| 202 |
|
requirements.txt
CHANGED
|
@@ -3,5 +3,5 @@ gymnasium>=1.1.1
|
|
| 3 |
numpy>=2.0.0
|
| 4 |
|
| 5 |
# ์ฃผ์: ์๋ Git URL์ ์์ ์ฑ์ ์ํด ํน์ ์ปค๋ฐ ํด์๋ก ๊ณ ์ ํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
|
| 6 |
-
robocasa @ git+https://github.com/brunomachado37/robocasa.git@lerobocasa
|
| 7 |
-
robosuite @ git+https://github.com/ARISE-Initiative/robosuite
|
|
|
|
| 3 |
numpy>=2.0.0
|
| 4 |
|
| 5 |
# ์ฃผ์: ์๋ Git URL์ ์์ ์ฑ์ ์ํด ํน์ ์ปค๋ฐ ํด์๋ก ๊ณ ์ ํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
|
| 6 |
+
# robocasa @ git+https://github.com/brunomachado37/robocasa.git@lerobocasa
|
| 7 |
+
# robosuite @ git+https://github.com/ARISE-Initiative/robosuite
|