Skip to content
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

Boundingbox on Link API #2353

Open
jfelixre opened this issue Apr 2, 2024 · 6 comments · May be fixed by #2787
Open

Boundingbox on Link API #2353

jfelixre opened this issue Apr 2, 2024 · 6 comments · May be fixed by #2787
Labels
enhancement New feature or request help wanted We accept pull requests!

Comments

@jfelixre
Copy link

jfelixre commented Apr 2, 2024

There is an alternative of Gazebo-classic's Link API Boundingbox function for ignition?

API reference page still shows a "TODO"

thanks!

@jfelixre jfelixre added the enhancement New feature or request label Apr 2, 2024
@azeey azeey moved this from Inbox to To do in Core development May 6, 2024
@azeey azeey added the help wanted We accept pull requests! label May 6, 2024
@azeey
Copy link
Contributor

azeey commented May 6, 2024

We already have the ability to get the bounding box, but it's through a component. Documenting this would be a good step as well.

@gabrielfpacheco gabrielfpacheco linked a pull request Feb 19, 2025 that will close this issue
9 tasks
@gabrielfpacheco
Copy link
Contributor

gabrielfpacheco commented Feb 19, 2025

We already have the ability to get the bounding box, but it's through a component. Documenting this would be a good step as well.

@azeey, isn't that only available to get the model bounding box, since the Physics plugin set it here?

I couldn’t find any source that actually sets a gz::components::AxisAligned for a link entity. Therefore, as I had to get the bounding box of the link for a system plugin I developed, I created #2787 and gazebosim/sdformat#1547 to provide such an API.

Please let me know if I'm missing something, I hope this could be helpful to others.

@iche033
Copy link
Contributor

iche033 commented Feb 19, 2025

I think the alternative approach would be to update the the physics system populate the bounding box component for links as well? I see the API available in gz-physics, GetLinkBoundingBox

@gabrielfpacheco
Copy link
Contributor

gabrielfpacheco commented Feb 26, 2025

I think the alternative approach would be to update the the physics system populate the bounding box component for links as well

Yes, I think this would probably be more straightforward. If I understood it correctly, this feature should be available for all currently supported physics engines, right?

I initially thought not to update the physics plugin because I did not want to add extra load to a critical plugin if this was not an actual requirement. However, I believe we could do the same as for the model and only update the link entities containing the corresponding components.

Maybe I could update #2787 to add this feature to the physics system and update the link API so that it only computes from the SDF if an AxisAlignedBox component does not exist for the link entity. Or I could completely remove the calculation via SDF if you think it is more adequate.

Please, let me know what would be the best path forward.

@iche033
Copy link
Contributor

iche033 commented Feb 28, 2025

I think getting the bounding box info from the physics system is preferred because it has the information already, and there is no need for a custom mesh bounding box calculator. In the rare case the the users does not load a physics system in Gazebo (or a particular physics engine does not support the bounding box feature), we could then fall back to using the SDF API.

I think the first step is to implement a similar logic for populating a model AxisAlignedBox for links in the physics system. The expected usage here is that plugin writers would need to manually create the AxisAlignedBox component for a Link, the physics system then populates it.

We can then update the Link class to add the AxisAlignedBox API like you did in #2787, except we would be the one creating the AxisAlignedBox component for the link in that class. I think this could be done through an EnableBoundingBoxChecks call (similar to EnableVelocityChecks).

If you're ok with this approach, could you do the changes in the physics system in a separate PR? Mainly just to make the review process easier. Thanks for the contributions so far!

@gabrielfpacheco
Copy link
Contributor

If you're ok with this approach, could you do the changes in the physics system in a separate PR? Mainly just to make the review process easier

Yeah, I like the suggested approach. As soon as I have some free cycles, I will make the changes to the open PR and open a new one for the physics.

Thanks for the contributions so far!

My pleasure :)

gabrielfpacheco added a commit to gabrielfpacheco/gz-sim that referenced this issue Mar 10, 2025
* Following gazebosim#2353 (comment)
* This allows to use the ECM as cache if bounding box doesn't have to be
recomputed and is more suitable so that other systems can determine the
AABB if necessary (e.g. physics system if checks are enabled)

Signed-off-by: Gabriel Pacheco <gabriel.fpacheco@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted We accept pull requests!
Projects
Status: To do
Development

Successfully merging a pull request may close this issue.

4 participants