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

Add support to get link AABB from its collisions #2787

Open
wants to merge 4 commits into
base: gz-sim9
Choose a base branch
from

Conversation

gabrielfpacheco
Copy link

@gabrielfpacheco gabrielfpacheco commented Feb 19, 2025

🎉 New feature

Summary

This PR adds AABB support to the Link API. It computes the overall link aligned bounding box (in local and world coordinates) by merging all collision bounding boxes obtained from their geometry shapes. Plus, it adds utility functions to transform AABB coordinates and calculate mesh AABB using utilities from gz::common::Mesh.

Test it

  • Checkout the appropriate gz-sim and sdformat branches
  • Build these packages
$ colcon build --packages-select sdformat15 gz-sim9 --merge-install
  • Run the following gz-sim9 tests:
$ ./build/gz-sim9/bin/UNIT_Util_TEST && ./build/gz-sim9/bin/INTEGRATION_link

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

/// collision shapes attached to the it. The link bounding box is
/// generated by merging all the bounding boxes of the collision
/// geometries.
/// \param _ecm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// \param _ecm
/// \param _ecm Entity-component manager.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 7cbf8a3

EXPECT_EQ(aab.Center(), math::Vector3d::Zero);

meshSdf.SetUri("duck.dae");
std::string filePath = common::joinPaths(std::string(PROJECT_SOURCE_PATH),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include <string>

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 469a446

TEST_F(UtilTest, TransformAxisAlignedBoxFrame)
{
// Creates a pseudo-random vector with values between -max and max
std::srand(std::time(nullptr));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include <cstdlib> and <ctime>

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 469a446

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏛️ ionic Gazebo Ionic
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

Boundingbox on Link API
2 participants