moveit / geometric_shapes

Representation of geometric shapes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Body::computeBoundingBox?

peci1 opened this issue · comments

I've noticed the interface of Body has methods computeBoundingSphere and computeBoundingCylinder, but there's no computeBoundingBox.

I think BBs are so common that it's a pity they're not in the interface. Also, the implementation would be super easy, as the most complicated (ConvexMesh) already computes a helper BB.

However, the other two existing methods are virtual, so it'd make sense to make these also virtual. But that would break ABI. What to do with that?

My suggestion:

  • kinetic-devel and indigo-devel: add non-virtual functions to each of the specific bodies, so that if you cast to the correct type, the method would be available, but the ABI doesn't have to change
  • melodic-devel (or whatever corresponds to master branch): add a normal virtual function to Body and its overrides to the specific bodies

When we agree on the best approach, I can prepare the PR.

And to be consistent with the return type of computeBounding*, there should be a new type BoundingBox defined. My proposal is to make it a typedef of Eigen::AlignedBox3d.

@peci1 I definitely think this would be useful, did you ever make a branch for this? I think for melodic-devel we should be willing to break ABI for this, but unless there's a demand for it, I don't think it's necessary to backport to indigo (for which support has explicitly ended already) or kinetic.

Should this return an axis aligned BB or an oriented BB? IMO there should be support for both.

Hey, I still haven't done that, but I can, at least for aligned BBs.

With oriented BBs, I'm not sure how to compute them, because there are too many degrees of freedom - should it be the least volume, or the least area, or the least circumference? Do you know of a working implementation? It'd probably be best to just use an existing library.

IMO least volume is the most useful for collision checking. The only implementation I could find was https://github.com/gabyx/ApproxMVBB, but I'd rather have it implemented in geometric_shapes as opposed to adding an external dependency to a source library. It's definitely non-trivial to add, so I wouldn't worry about it for now, we can focus on getting AABBs in.

This is now implemented for Noetic (both axis-aligned and oriented bounding boxes), and hopefully getting into Melodic soon.