2222
2323import isaaclab .sim as sim_utils
2424from isaaclab .assets import RigidObjectCfg
25+ from isaaclab .envs .mdp .actions .pink_task_space_actions import PinkInverseKinematicsAction
2526from isaaclab .envs .mdp .recorders .recorders_cfg import ActionStateRecorderManagerCfg
2627from isaaclab .managers import DatasetExportMode , EventTermCfg , SceneEntityCfg
2728from isaaclab .managers .recorder_manager import RecorderManagerBaseCfg
2829from isaaclab .utils .assets import ISAAC_NUCLEUS_DIR , ISAACLAB_NUCLEUS_DIR
2930from isaaclab .utils .datasets import HDF5DatasetFileHandler
3031from isaaclab .utils .string import string_to_callable
32+ from isaaclab_physx .sim .schemas import PhysxRigidBodyPropertiesCfg
3133from isaaclab_tasks .utils .parse_cfg import parse_env_cfg
3234
3335from autodata_interfaces .env .env_profile import EnvironmentProfile , convert_event_params
36+ from autodata_interfaces .env .pink_ik_action import PinkInverseKinematicsActionSharedUrdf
3437from autodata_interfaces .tasks .generation_policy_spec import GenerationPolicy
3538
3639
@@ -58,6 +61,7 @@ def get_env_name_from_dataset(input_file_path: str) -> str:
5861 dataset_file_handler = HDF5DatasetFileHandler ()
5962 dataset_file_handler .open (input_file_path )
6063 env_name = dataset_file_handler .get_env_name ()
64+ dataset_file_handler .close ()
6165 assert env_name is not None , "Environment name not found in dataset"
6266 return env_name
6367
@@ -96,7 +100,7 @@ def apply_env_profile(env_cfg: Any, profile: EnvironmentProfile, env_name: str)
96100 spawn = sim_utils .UsdFileCfg (
97101 usd_path = usd_path ,
98102 scale = add_spec .scale ,
99- rigid_props = sim_utils . RigidBodyPropertiesCfg (** add_spec .rigid_props ),
103+ rigid_props = PhysxRigidBodyPropertiesCfg (** add_spec .rigid_props ),
100104 ),
101105 ),
102106 )
@@ -153,6 +157,7 @@ def setup_env_config(
153157 generation_policy_params : GenerationPolicy ,
154158 recorder_cfg : RecorderManagerBaseCfg | None = None ,
155159 env_profile : EnvironmentProfile | None = None ,
160+ enable_cameras : bool = False ,
156161) -> tuple [Any , Any ]:
157162 """Configure the environment for data generation.
158163
@@ -171,13 +176,24 @@ def setup_env_config(
171176 recorder_cfg: Optional recorder manager config; defaults to an action/state recorder.
172177 env_profile: Optional environment profile overlaid on the parsed config (scene additions,
173178 reset-event changes) before the generation-specific adjustments below.
179+ enable_cameras: Record the task's image observations. Defaults to low-dimensional
180+ observations, excluding the cameras used for teleoperation previews.
174181
175182 Returns:
176183 A tuple of the environment configuration and the success termination condition.
177184 """
178185 env_cfg = parse_env_cfg (env_name , device = device , num_envs = num_envs )
179186 env_cfg .env_name = env_name
180187
188+ # Lab's Pink controller forces a USD conversion per instance. Resolve the
189+ # shared model once before creating the independent per-environment solvers.
190+ for action_cfg in vars (env_cfg .actions ).values ():
191+ if getattr (action_cfg , "class_type" , None ) in (
192+ PinkInverseKinematicsAction ,
193+ f"{ PinkInverseKinematicsAction .__module__ } :{ PinkInverseKinematicsAction .__name__ } " ,
194+ ):
195+ action_cfg .class_type = PinkInverseKinematicsActionSharedUrdf
196+
181197 if env_profile is not None :
182198 apply_env_profile (env_cfg , env_profile , env_name )
183199
@@ -190,6 +206,18 @@ def setup_env_config(
190206 env_cfg .terminations = None
191207 env_cfg .observations .policy .concatenate_terms = False
192208
209+ # Lab 3.0 humanoid tasks include teleoperation preview cameras. Keep the
210+ # existing low-dimensional generation workflow unless images are requested.
211+ if not enable_cameras and hasattr (env_cfg , "image_obs_list" ):
212+ for image_name in env_cfg .image_obs_list :
213+ image_term = getattr (env_cfg .observations .policy , image_name , None )
214+ if image_term is not None :
215+ sensor_cfg = image_term .params .get ("sensor_cfg" )
216+ if sensor_cfg is not None :
217+ setattr (env_cfg .scene , sensor_cfg .name , None )
218+ setattr (env_cfg .observations .policy , image_name , None )
219+ env_cfg .image_obs_list = []
220+
193221 # Setup recorders
194222 if recorder_cfg is None :
195223 env_cfg .recorders = ActionStateRecorderManagerCfg ()
0 commit comments