Skip to content
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
3 changes: 3 additions & 0 deletions embodichain/lab/sim/objects/rigid_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ def set_local_pose(
# we should keep `pose_` life cycle to the end of the function.
pose = torch.cat((quat, xyz), dim=-1)
indices = self.body_data.gpu_indices[local_env_ids]
torch.cuda.synchronize(self.device)
self._ps.gpu_apply_rigid_body_data(
data=pose.clone(),
gpu_indices=indices,
Expand Down Expand Up @@ -458,6 +459,7 @@ def add_force_torque(

else:
indices = self.body_data.gpu_indices[local_env_ids]
torch.cuda.synchronize(self.device)
if force is not None:
self._ps.gpu_apply_rigid_body_data(
data=force,
Expand Down Expand Up @@ -658,6 +660,7 @@ def clear_dynamics(self, env_ids: Sequence[int] | None = None) -> None:
(len(local_env_ids), 3), dtype=torch.float32, device=self.device
)
indices = self.body_data.gpu_indices[local_env_ids]
torch.cuda.synchronize(self.device)
self._ps.gpu_apply_rigid_body_data(
data=zeros,
gpu_indices=indices,
Expand Down
2 changes: 2 additions & 0 deletions embodichain/lab/sim/objects/rigid_object_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ def set_local_pose(
indices = self.body_data.gpu_indices[local_env_ids][
:, local_obj_ids
].flatten()
torch.cuda.synchronize(self.device)
self._ps.gpu_apply_rigid_body_data(
data=pose.clone(),
gpu_indices=indices,
Expand Down Expand Up @@ -433,6 +434,7 @@ def clear_dynamics(self, env_ids: Sequence[int] | None = None) -> None:
device=self.device,
)
indices = self.body_data.gpu_indices[local_env_ids].flatten()
torch.cuda.synchronize(self.device)
self._ps.gpu_apply_rigid_body_data(
data=zeros,
gpu_indices=indices,
Expand Down
Loading