Closed kurtenkera closed 6 months ago
@yuvaltassa @saran-t @quagla It just occurred to me that the convex hull is probably comprised of a finite set of points $\in \mathbb{R}^3$ in the original STL/MSH file under consideration. And a smooth surface used for collision detection purposes is probably derived by connecting this finite set of points with flat faces. Is this true?
I'm still interested in methods for obtaining the original points in the convex hull if this is possible, as well as methods for viewing the convex hull during simulation?
Ideally I would like to iterate over the faces of the convex hull of a mesh/geom/flexcomp, and access the respective vertices/vertex indices.
Hi,
I want to know how I can both "obtain" and "view" the (x,y,z) spatial points in the convex hull of a given (1) primitive
geom
(e.g., sphere, ellipsoid, box, capsule, cylinder), (b) rigidgeom
that references an STL file of a CAD geometry and (c) softflexcomp
that references a MSH file.Note, by "obtain", I mean that I wish to store all of the points within the convex hull in a Numpy array (e.g., with
shape = (n_convexhullpts, 3)
) since I am using the Python bindings to access MuJoCo. By "view", I wish to view these points during a simulation using any recommended approach (note, I attempted to follow the advice described in issue #499, but had no luck).I will label all of my specific questions below:
Q1: When I play around with the XML file below (see below) of a
box
falling from a height at various initialeuler
rotations, it appears that there are only 8 points in the convex hull of the boxgeom
(i.e., the 8 corners).This is evident to me, simply from the highlighted contacts which I am able to manually activate in the MuJoCo simulation GUI (see 4 highlighted contacts at the corners below):
Is there a way to obtain these 8 points (measured from either the world frame or local body frame) computationally through one of the
mjModel
attributes? For example, is there an attribute for all of the primitivegeom
objects which returns the points in their convex hull that are used for potential collision events (i.e. where the points are measured in the world or local body frame and stored in a Numpy array withshape = (n_convexhullpts, 3)
)? I have explored the mjModel documentation but cannot find anything?Q2: Is there a nice general way to view all possible contact points in the convex hull of any primitive
geom
during simulation (e.g. for thebox
falling from some height, is there a way to view all 8 points in the convex hull throughout the simulation)?Q3: I've created a simulation of a falling rigid hollow cylinder that references an STL file (contained in this ZIP folder: hollow_cylinder.zip). I did this using the code below:
The animation is shown here:
https://github.com/google-deepmind/mujoco/assets/127472392/8575ed2d-06f0-498b-95ec-dc6609c768ca
How can I computationally obtain all of the spatial points in the convex hull of this geom that references an STL file? It seems like the way to access this information using C/C++ is described here. However I need to do this in Python?
Q4: Is
model.mesh_vertnum
equal to the number of points in the convex hull of the above geom that references the STL file? (NOTE: For my hollow cylinder,model.mesh_vertnum = [504]
)Q5: What does
model.mesh_graph
return? For my above STL file,model.mesh_graph
returned an array with 3758 elements. The documentation suggests thatmodel.mesh_graph
contains information related to the convex hull but I'm not sure what these 3758 elements are?Q6: How can I view all spatial points in the convex hull of my hollow cylinder that references an STL file?
Q7: Finally, I'd like to also know how to view and obtain all spatial points in the convex hull of a
flexcomp
object that references a MSH file?