Skip to content

Commit 63f585f

Browse files
committed
Fixes camera unittest by adding missing sim.step() calls
1 parent 78692be commit 63f585f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

source/extensions/omni.isaac.orbit/test/sensors/test_camera.py

+9
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,13 @@ def test_camera_init(self):
9898
# Check if camera prim is set correctly and that it is a camera prim
9999
self.assertEqual(camera._sensor_prims[0].GetPath().pathString, self.camera_cfg.prim_path)
100100
self.assertIsInstance(camera._sensor_prims[0], UsdGeom.Camera)
101+
101102
# Simulate for a few steps
102103
# note: This is a workaround to ensure that the textures are loaded.
103104
# Check "Known Issues" section in the documentation for more details.
104105
for _ in range(5):
105106
self.sim.step()
107+
106108
# Check buffers that exists and have correct shapes
107109
self.assertEqual(camera.data.pos_w.shape, (1, 3))
108110
self.assertEqual(camera.data.quat_w_ros.shape, (1, 4))
@@ -111,6 +113,7 @@ def test_camera_init(self):
111113
self.assertEqual(camera.data.intrinsic_matrices.shape, (1, 3, 3))
112114
self.assertEqual(camera.data.image_shape, (self.camera_cfg.height, self.camera_cfg.width))
113115
self.assertEqual(camera.data.info, [{self.camera_cfg.data_types[0]: None}])
116+
114117
# Simulate physics
115118
for _ in range(10):
116119
# perform rendering
@@ -184,6 +187,12 @@ def test_camera_init_offset(self):
184187
rtol=1e-5,
185188
)
186189

190+
# Simulate for a few steps
191+
# note: This is a workaround to ensure that the textures are loaded.
192+
# Check "Known Issues" section in the documentation for more details.
193+
for _ in range(5):
194+
self.sim.step()
195+
187196
# check if transform correctly set in output
188197
np.testing.assert_allclose(camera_ros.data.pos_w[0].cpu().numpy(), cam_cfg_offset_ros.offset.pos, rtol=1e-5)
189198
np.testing.assert_allclose(camera_ros.data.quat_w_ros[0].cpu().numpy(), QUAT_ROS, rtol=1e-5)

0 commit comments

Comments
 (0)