Using loaded meshes for external visualization

Discussion in 'Visualization' started by lukedan, Aug 1, 2018.

  1. Hello,

    I've been trying to visualize mujoco simulations externally and have encountered several problems. Firstly, it seems that the vertex data of all loaded meshes are scaled internally by a factor of 100 while that used for simulation is not. Is this just undocumented behavior or is this caused by some obscure properties? Secondly, in the modeling section of the documentation it is said that translational and rotational offsets used to center and align the meshes are saved, but it seems that they're not exposed through the API. Is there any way in which I can obtain that information?

    Thanks.
     
  2. Hello,

    Here's an example of the problem we're facing right now. As you can see, we're trying to fit a fully textured model at the exact position of the original one (since STL meshes don't support textures) and there's usually a small displacement between them. Is there any way that we can solve this problem?
    capture.PNG

    Thanks.
     
    Last edited: Aug 9, 2018
  3. Just realized that I added the 100x scale myself when loading the mesh for visualization purposes earlier.
     
  4. Hello,

    I've tried to replicate the way to process meshes specified in http://www.mujoco.org/book/modeling.html#mesh but can't quite get it right. Here are some problems I have:
    1. Do you calculate both the mesh's COM and inertia tensor at the same time, or do you first calculate its COM, offset all vertices, then calculate the inertia tensor with respect to the new origin? The problem is, a lot of meshes I'm currently working with are not enclosed, so not only does that make calculating their COM tricky, but it also makes the order in which these calculations are performed relevant.
    2. How do you determine which principal axes are used as the x, y, and z axes? Not only can they be shuffled, but they can also be negated and point to the opposite direction. I tried to choose the configuration that's as close to the original as possible, but while some meshes are correctly aligned (with a small error still, which I suspect is caused by the first problem), others are not. For now the choice of principal axes seems a bit arbitrary to me.
    Any help would be greatly appreciated.