Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: gpu sim compatibility issues
Browse files Browse the repository at this point in the history
arth-shukla committed Jan 22, 2024
1 parent 9a914ad commit faa5f61
Showing 4 changed files with 14 additions and 31 deletions.
2 changes: 1 addition & 1 deletion mani_skill2/agents/controllers/pd_base_vel.py
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ def set_action(self, action: np.ndarray):
new_action = np.hstack([vel, action[2:]])

for i, joint in enumerate(self.joints):
joint.set_drive_velocity_target(new_action[i])
joint.set_drive_velocity_target(np.array([new_action[i]]))


class PDBaseVelControllerConfig(PDJointVelControllerConfig):
2 changes: 1 addition & 1 deletion mani_skill2/agents/robots/fetch/fetch.py
Original file line number Diff line number Diff line change
@@ -289,7 +289,7 @@ def is_grasping(self, object: Actor = None, min_impulse=1e-6, max_angle=85):
self.scene.px.gpu_create_contact_query(body_pairs),
(len(object._bodies), 3),
)
print(f"Create query for Panda grasp({object.name})")
print(f"Create query for Fetch grasp({object.name})")
query, contacts_shape = self.queries[object.name]
self.scene.px.gpu_query_contacts(query)
# query.cuda_contacts # (num_unique_pairs * num_envs, 3)
24 changes: 12 additions & 12 deletions mani_skill2/utils/sapien_utils.py
Original file line number Diff line number Diff line change
@@ -294,13 +294,13 @@ def get_pairwise_contacts(
pairwise_contacts = []
for contact in contacts:
if (
contact.components[0].entity == actor0
and contact.components[1].entity == actor1
contact.bodies[0].entity == actor0
and contact.bodies[1].entity == actor1
):
pairwise_contacts.append((contact, True))
elif (
contact.components[0].entity == actor1
and contact.components[1].entity == actor0
contact.bodies[0].entity == actor1
and contact.bodies[1].entity == actor0
):
pairwise_contacts.append((contact, False))
return pairwise_contacts
@@ -328,9 +328,9 @@ def get_actor_contacts(
) -> List[Tuple[physx.PhysxContact, bool]]:
entity_contacts = []
for contact in contacts:
if contact.components[0].entity == actor:
if contact.bodies[0].entity == actor:
entity_contacts.append((contact, True))
elif contact.components[1].entity == actor:
elif contact.bodies[1].entity == actor:
entity_contacts.append((contact, False))
return entity_contacts

@@ -348,16 +348,16 @@ def get_articulation_contacts(
if included_links is None:
included_links = links
for contact in contacts:
if contact.components[0] in included_links:
if contact.components[1] in links:
if contact.bodies[0] in included_links:
if contact.bodies[1] in links:
continue
if contact.components[1].entity in excluded_entities:
if contact.bodies[1].entity in excluded_entities:
continue
articulation_contacts.append((contact, True))
elif contact.components[1] in included_links:
if contact.components[0] in links:
elif contact.bodies[1] in included_links:
if contact.bodies[0] in links:
continue
if contact.components[0].entity in excluded_entities:
if contact.bodies[0].entity in excluded_entities:
continue
articulation_contacts.append((contact, False))
return articulation_contacts
17 changes: 0 additions & 17 deletions test.py

This file was deleted.

0 comments on commit faa5f61

Please sign in to comment.