HoliInn
HoliInn

Reputation: 189

How to get axis aligned bounding box of convex bodies

I'd like to set the position of some convex bodies such that the body is flush against a ground plane.

To do so, I want to calculate the axis aligned bounding box so I can use the lowest point on the body.

I am adding convex bodies like this:

            cv_shape = Convex(str(ROOT_PATH / mesh_path_list[body_idx]), scale=scale_factors[body_idx])

            name = f"polytope_{body_idx}"
            instance =self.plant.AddModelInstance(name)
            H = RigidTransform(RotationMatrix(np.eye(3)), np.zeros(3))

            body = self.plant.AddRigidBody(
                name, instance,
                SpatialInertia(mass=m,
                               p_PScm_E=np.array([0., 0., 0.]),
                               G_SP_E=inertia))
            geom_id = self.plant.RegisterCollisionGeometry(
                body, H,
                cv_shape, name,
                pydrake.multibody.plant.CoulombFriction(mu, mu))

How to get the AABB?

Upvotes: 0

Views: 135

Answers (1)

Sean Curtis
Sean Curtis

Reputation: 1923

This is related to Drake issue #18421. A user had specifically requested an Obb for the mesh in place of the Aabb. I believe that user had obtained the Aabb by directly reading the obj in as a SurfaceTriangleMesh and then asking the mesh for its axis-aligned box. That issue will be resolved soon and we'll provide access for Aabb and Obb for shapes more generally via more public APIs.

Upvotes: 1

Related Questions