Skip to content

Commit e24a360

Browse files
committed
wip
1 parent 0d9b22c commit e24a360

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

embodichain/lab/sim/sensors/camera.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,15 @@ def group_id(self) -> int:
263263
)
264264
return -1
265265

266+
@property
267+
def is_attached(self) -> bool:
268+
"""Check if the camera is attached to a parent entity.
269+
270+
Returns:
271+
bool: True if the camera is attached to a parent entity, False otherwise.
272+
"""
273+
return self.cfg.extrinsics.parent is not None
274+
266275
def update(self, **kwargs) -> None:
267276
"""Update the sensor data.
268277

embodichain/lab/sim/utility/keyboard_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,9 @@ def run_keyboard_control_for_camera(
213213
log_info("Reset to initial pose")
214214
elif key == ord("p"):
215215
new_pose_print = new_pose.copy()
216-
new_pose_print[:3, 1] = -new_pose_print[:3, 1]
217-
new_pose_print[:3, 2] = -new_pose_print[:3, 2]
216+
if sensor.is_attached is False:
217+
new_pose_print[:3, 1] = -new_pose_print[:3, 1]
218+
new_pose_print[:3, 2] = -new_pose_print[:3, 2]
218219
translation = new_pose_print[:3, 3]
219220
rot = R.from_matrix(new_pose_print[:3, :3])
220221
quaternion = rot.as_quat()

0 commit comments

Comments
 (0)