Skip to content

Commit b37857b

Browse files
committed
Modify the logic to allow changing the Camera Type and Resolution through environment variables
1 parent 4bf6902 commit b37857b

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

source/extensions/humanoid.tasks/humanoid/tasks/push_box/push_box_env.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ class PushBoxEnvCfg(DirectRLEnvCfg):
197197
)
198198

199199
# cameras
200-
width = 320
201-
height = 240
200+
width = int(os.environ.get("ISAAC_LAB_CAMERA_WIDTH", 320))
201+
height = int(os.environ.get("ISAAC_LAB_CAMERA_HEIGHT", 240))
202202
camera = CameraCfg(
203203
prim_path="/World/envs/env_.*/Robot/d435_rgb_module_link/camera",
204204
# update_period=0.1,
@@ -278,10 +278,15 @@ def _setup_scene(self):
278278
self.state_only = True
279279

280280
if not self.state_only:
281-
self.camera = Camera(self.cfg.third_person_camera)
282-
# self.camera = Camera(self.cfg.camera)
283-
# self.camera = Camera(self.cfg.tiled_third_person_camera)
284-
# self.camera = Camera(self.cfg.tiled_camera)
281+
camera_type = os.environ.get("ISAAC_LAB_CAMERA_TYPE", "THIRD_PERSON_CAMERA")
282+
if camera_type == "THIRD_PERSON_CAMERA":
283+
self.camera = Camera(self.cfg.third_person_camera)
284+
elif camera_type == "CAMERA":
285+
self.camera = Camera(self.cfg.camera)
286+
elif camera_type == "TILED_THIRD_PERSON_CAMERA":
287+
self.camera = Camera(self.cfg.tiled_third_person_camera)
288+
elif camera_type == "TILED_CAMERA":
289+
self.camera = Camera(self.cfg.tiled_camera)
285290

286291
self.cabinet = Articulation(self.cfg.cabinet)
287292
self.tomato_soup_can = RigidObject(self.cfg.tomato_soup_can)

source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/direct/shadow_hand/shadow_hand_camera_env.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from __future__ import annotations
88

9+
import os
910
import gymnasium as gym
1011
import numpy as np
1112
import torch
@@ -40,8 +41,8 @@ class ShadowHandRGBCameraEnvCfg(ShadowHandEnvCfg):
4041
spawn=sim_utils.PinholeCameraCfg(
4142
focal_length=24.0, focus_distance=400.0, horizontal_aperture=20.955, clipping_range=(0.1, 20.0)
4243
),
43-
width=320,
44-
height=240,
44+
width = int(os.environ.get("ISAAC_LAB_CAMERA_WIDTH", 320)),
45+
height = int(os.environ.get("ISAAC_LAB_CAMERA_HEIGHT", 240)),
4546
)
4647
# tiled_camera: CameraCfg = CameraCfg(
4748
# prim_path="/World/envs/env_.*/Camera",
@@ -77,8 +78,8 @@ class ShadowHandRGBDCameraEnvCfg(ShadowHandEnvCfg):
7778
spawn=sim_utils.PinholeCameraCfg(
7879
focal_length=24.0, focus_distance=400.0, horizontal_aperture=20.955, clipping_range=(0.1, 20.0)
7980
),
80-
width=160,
81-
height=120,
81+
width = int(os.environ.get("ISAAC_LAB_CAMERA_WIDTH", 320)),
82+
height = int(os.environ.get("ISAAC_LAB_CAMERA_HEIGHT", 240)),
8283
)
8384
write_image_to_file = False
8485

@@ -101,8 +102,8 @@ class ShadowHandDepthCameraEnvCfg(ShadowHandEnvCfg):
101102
spawn=sim_utils.PinholeCameraCfg(
102103
focal_length=24.0, focus_distance=400.0, horizontal_aperture=20.955, clipping_range=(0.1, 20.0)
103104
),
104-
width=320,
105-
height=240,
105+
width = int(os.environ.get("ISAAC_LAB_CAMERA_WIDTH", 320)),
106+
height = int(os.environ.get("ISAAC_LAB_CAMERA_HEIGHT", 240)),
106107
)
107108
write_image_to_file = False
108109

0 commit comments

Comments
 (0)