-
Notifications
You must be signed in to change notification settings - Fork 42
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.
""" | ||
:param rotated: If True, return the rotated bounding box, otherwise the axis-aligned bounding box. | ||
:return: The axis-aligned or rotated bounding box of a link. First try to get it from the simulator, if not, | ||
then calculate it depending on the type of the link geometry. |
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.
Add return to doc string
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.
What do you mean? there is already a :return: in the doc string.
…_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
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.