Skip to content

Commit

Permalink
bug fix with adding mounted cameras
Browse files Browse the repository at this point in the history
  • Loading branch information
StoneT2000 committed Mar 1, 2024
1 parent dc88432 commit 69c95ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 4 additions & 1 deletion mani_skill2/envs/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,12 @@ def add_mounted_camera(
camera.set_fovy(fovy, compute_x=True)
camera.near = near
camera.far = far
camera.set_gpu_pose_batch_index(mount._objs[i].gpu_pose_index)
if physx.is_gpu_enabled():
camera.set_gpu_pose_batch_index(mount._objs[i].gpu_pose_index)
if isinstance(mount, Link):
mount._objs[i].entity.add_component(camera)
else:
mount._objs[i].add_component(camera)
camera.local_pose = pose
camera.name = f"scene-{i}_{name}"
cameras.append(camera)
Expand Down
8 changes: 3 additions & 5 deletions mani_skill2/sensors/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,10 @@ def __init__(
self.entity = None
else:
if articulation is None:
# TODO (stao): This line certainly should not work. Fix to support adding mounted cameras to non articulated objects (Actors here then)
# self.entity = get_obj_by_name(scene.get_entities(), entity_uid)
raise NotImplementedError(
"Adding cameras mounted to non articulated objects has not been implemented yet"
)
pass
else:
# if given an articulation and entity_uid (as a string), find the correct link to mount on
# this is just for convenience so robot configurations can pick link to mount to by string/id
self.entity = get_obj_by_name(articulation.get_links(), entity_uid)
if self.entity is None:
raise RuntimeError(f"Mount entity ({entity_uid}) is not found")
Expand Down

0 comments on commit 69c95ea

Please sign in to comment.