Skip to content

Commit

Permalink
Address reviews
Browse files Browse the repository at this point in the history
- Remove leftover comments
- MeshMappingMethods inherit from IntEnum instead of Enum
- Added center comparison for MeshCollision object
  • Loading branch information
lorycontixd committed Nov 15, 2024
1 parent 644ce43 commit b0ddec1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/jaxsim/parsers/descriptions/collision.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,11 @@ def __eq__(self, other: BoxCollision) -> bool:

@dataclasses.dataclass
class MeshCollision(CollisionShape):

center: npt.NDArray[np.float64]
center: npt.NDArray

def __eq__(self, other: Any) -> bool:
if not isinstance(other, MeshCollision):
return False
return len(self.collidable_points) == len(
other.collidable_points
) and super().__eq__(other)
) and super().__eq__(other) and (self.center == other.center).all()
4 changes: 2 additions & 2 deletions src/jaxsim/parsers/rod/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,10 @@ def create_mesh_collision(
points = mesh.vertices
H = (
collision.pose.transform() if collision.pose is not None else np.eye(4)
) # pose of the collision object
)
center_of_collision_wrt_link = (H @ np.hstack([0, 0, 0, 1.0]))[
0:-1
] # @ = matrix multiplication, hstack = stack arrays in sequence horizontally => center of the collision object
]
mesh_points_wrt_link = (
H @ np.hstack([points, np.vstack([1.0] * points.shape[0])]).T
)[0:3, :]
Expand Down

0 comments on commit b0ddec1

Please sign in to comment.