-
Notifications
You must be signed in to change notification settings - Fork 43
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
Mesh and object #206
base: dev
Are you sure you want to change the base?
Mesh and object #206
Conversation
…g box depending on the visual shape of the link. Corrected multiverse mesh visual shape parsing. Added methods to get mesh path and file name.
src/pycram/cache_manager.py
Outdated
@@ -50,7 +52,8 @@ def delete_cache_dir(self): | |||
|
|||
def update_cache_dir_with_object(self, path: str, ignore_cached_files: bool, | |||
object_description: 'ObjectDescription', object_name: str, | |||
scale_mesh: Optional[float] = None) -> str: | |||
scale_mesh: Optional[float] = None, | |||
mesh_transform: Optional['Transform'] = None) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to put Transform in quotation marks if you add the import:
from future import annotations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh that's nicee thanks
return cls(min_point[0], min_point[1], min_point[2], max_point[0], max_point[1], max_point[2]) | ||
:return: The points of the bounding box as a list of Point instances. | ||
""" | ||
return [Point(self.min_x, self.min_y, self.min_z), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intended like this? and why are there so many points?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes these are the 8 corners of the bounding box.
…_object # Conflicts: # src/pycram/worlds/multiverse.py # test/test_multiverse.py
…_object # Conflicts: # src/pycram/worlds/multiverse.py
|
||
|
||
@dataclass | ||
class RotatedBoundingBox(BoundingBox): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why dont use a polytope here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add the convex hull version which is available directly from trimesh, but this does not remove the need for a rotated shape, because the rotation here is meant to rotate the shape to the current pose of the link, this rotation will also be needed in a polytope or a convex hull as we only get the points relative to the object origin and are aligned with world frame not with object current frame.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added a method to get convex hull
@@ -785,7 +785,7 @@ def get_aabb_for_link(self) -> AxisAlignedBoundingBox: | |||
link_pose_trans = self.link.transform | |||
inverse_trans = link_pose_trans.invert() | |||
prospection_object.set_orientation(inverse_trans.to_pose()) | |||
return self.link.get_axis_aligned_bounding_box() | |||
return self.link.get_bounding_box() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this mean that the bounding box is not necessarily axis aligned?
@@ -26,6 +27,14 @@ def get_point_as_list(point: Point) -> List[float]: | |||
return [point.x, point.y, point.z] | |||
|
|||
|
|||
def get_list_from_points(points: List[Point]) -> List[List[float]]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No documentation
transform) | ||
|
||
def get_corners(self, transform: Optional[Transform] = None) -> List[List[float]]: | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No documentation
@@ -487,7 +501,7 @@ def get_link_axis_aligned_bounding_box(self, link_name: str) -> AxisAlignedBound | |||
:param link_name: The name of the link. | |||
:return: The axis aligned bounding box of the link. | |||
""" | |||
return self.links[link_name].get_axis_aligned_bounding_box() | |||
return self.links[link_name].get_bounding_box() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could Return a bounding box that is Not Anis aligned which is confusing given the Method Name
Added some extra functionality to use information from the meshes and adjust the meshes before they are cached if needed.
Added the option of getting the axis_aligned_bounding_box from mesh and link geometry in general instead of only from simulator, this adds more flexibility and does not require the simulator always to provide this functionality.
Also now there is rotated_bounding_box, and convex hull.
Added the option to provide callbacks for object addition and removal to be used by the users if needed.