Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more flexible pose setting for merged actors/articulation views on CPU #260

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions mani_skill/utils/structs/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,15 @@ def pose(self, arg1: Union[Pose, sapien.Pose, Array]) -> None:
self._body_data_index[self._scene._reset_mask[self._scene_idxs]], :7
] = arg1
else:
# TODO (stao): some tasks use views over multiple objects but need to work on GPU sim so self._objs may not be across different scenes
# and this code won't work.
self._objs[0].pose = to_sapien_pose(arg1)
if isinstance(arg1, sapien.Pose):
for obj in self._objs:
obj.pose = arg1
else:
if len(arg1.shape) == 2:
for obj in self._objs:
obj.pose = to_sapien_pose(arg1[0])
else:
arg1 = to_sapien_pose(arg1)

def set_pose(self, arg1: Union[Pose, sapien.Pose]) -> None:
self.pose = arg1
10 changes: 9 additions & 1 deletion mani_skill/utils/structs/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,15 @@ def pose(self, arg1: Union[Pose, sapien.Pose]) -> None:
self._body_data_index[self._scene._reset_mask[self._scene_idxs]], :7
] = vectorize_pose(arg1)
else:
self._objs[0].pose = to_sapien_pose(arg1)
if isinstance(arg1, sapien.Pose):
for obj in self._objs:
obj.pose = arg1
else:
if len(arg1.shape) == 2:
for obj in self._objs:
obj.pose = to_sapien_pose(arg1[0])
else:
arg1 = to_sapien_pose(arg1)

def set_pose(self, arg1: Union[Pose, sapien.Pose]) -> None:
self.pose = arg1
Expand Down
4 changes: 4 additions & 0 deletions mani_skill/utils/structs/pose.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ def __len__(self):
def shape(self):
return self.raw_pose.shape

@property
def device(self):
return self.raw_pose.device

# -------------------------------------------------------------------------- #
# Functions from sapien.Pose
# -------------------------------------------------------------------------- #
Expand Down