Collision mesh/surface map representation

Discussion in 'Priority support' started by OkayHuman, Feb 8, 2019.

  1. Is there some sort of collision mesh representation we can retrieve per object, and how?

    Or some way to simulate a lidar point cloud representation?
     
  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    All geometry is in the model -- meshes as well as analytical shapes. There is a rangefinder sensor, but using it to obtain a point cloud would be inefficient. It is better to render (possibly offscreen) and use the Z-buffer from the renderer. See codes sample record.cpp for offscreen rendering.
     
    OkayHuman likes this.
  3. 1. From what I understand, each of my objects has a geom and mesh. Both determine collision properties. But does one override the other?
    2. I don't see a geom2id, so I assume the index of the geom names corresponds to that geom's index in the friction, quat, contype arrays?
    3. How do I figure out which mesh is actually associated with a named object?
     

    Attached Files:

    • mesh.png
      mesh.png
      File size:
      143.5 KB
      Views:
      133
    • geom.png
      geom.png
      File size:
      137.8 KB
      Views:
      134
  4. Emo Todorov

    Emo Todorov Administrator Staff Member

    There are bodies, geoms and meshes. Bodies are things that have Cartesian frames and inertial properties, and degrees of freedom defined by joints. One body can have multiple geoms attached rigidly to it; if you want to model non-convex objects, this is done by attaching multiple convex geoms to the same body. Geoms are the things that collide with each other. Each geom has a geom type -- which can be mesh, height field, or one of the built-in geometric primitives (plane, sphere etc). You define meshes in the assets section, but that by itself does not instantiate them in model world. They are only instantiated when a geom has type "mesh" and references a given mesh.

    The function mj_name2id is used for all object types. The first argument is the type, mjOBJ_GEOM in this case.

    If you want to know if a mesh has been instantiated, loop through all geoms, find geoms whose type is mesh, and check if the object id for the geom corresponds to the mesh of interest.