Where do you get the data to put in the inertial tag in MuJoCo?

Please don't post Bullet support questions here, use the above forums instead.
Post Reply
motorcitycobra
Posts: 1
Joined: Mon Feb 21, 2022 7:59 pm

Where do you get the data to put in the inertial tag in MuJoCo?

Post by motorcitycobra »

This is a MuJoCo question, but maybe you can answer even if you don't use MuJoCo.
When I import meshes, (3D objects) each one of those objects that have mass require an "inertial" tag, which contains the mass, the diagonal from the inertia matrix, and the "pos", which the docs say is the "position of the inertial frame of reference". What is this last thing? I don't know where to find this. It's an x, y, z value.
What would the position of the inertial frame of reference be for a cube with nothing else?

Code: Select all

    <mujoco model="egg_slicer">
        <compiler angle="radian" meshdir="meshes/"/>
        <default class="viz">
            <geom contype="5" conaffinity="1" group="1" type="mesh" rgba=".51 .6 .7 1"/>
        </default>

        <asset>
            <mesh name="base"         file="egg_mash1.stl" />
            <mesh name="swing"         file="egg_mash2.stl"/>
        </asset>
        <asset>
            <texture type="skybox" builtin="gradient" rgb1="0.6 0.6 0.6" rgb2="0 0 0" width="512" height="512"/> -->
            <texture name="texplane" type="2d" builtin="checker" rgb1=".25 .25 .25" rgb2=".3 .3 .3" width="512" height="512" mark="cross" markrgb=".8 .8 .8"/>
            <material name="matplane" reflectance="0.3" texture="texplane" texrepeat="1 1" texuniform="true"/>
        </asset>
        <worldbody>

            <geom name="floor" pos="0 0 -0.5" size="0 0 1" type="plane" material="matplane"/>
            <light directional="true" diffuse=".8 .8 .8" specular=".2 .2 .2" pos="0 0 5" dir="0 0 -1"/>

            <!-- start building our model -->
            <body>
                <joint type="free" limited='false' damping="0" stiffness="1" armature="0"/>

                <geom name="slicer_base" mesh="base" class="viz"/>
                    <inertial pos="0 0 0" mass="1" diaginertia="0.01 0.01 0.01" />

                <body pos="0 0 0">
                    <joint name="hinge" pos="228.60 120.56 33.58"
                    axis="0 0 1"
                    limited="true" range="-3.0 0" /> -->
                    <geom name="slicer_swing" mesh="swing" class="viz"/>
                    <inertial pos="228.60 120.56 33.58" mass="703.29" diaginertia="1.36 3.96 5.21"/>
                </body>
            </body>
        </worldbody>

        <actuator>
            <motor name="hinge" gear="100" joint="hinge"/>
        </actuator>
    </mujoco>
raigan2
Posts: 197
Joined: Sat Aug 19, 2006 11:52 pm

Re: Where do you get the data to put in the inertial tag in MuJoCo?

Post by raigan2 »

I don't know if this is true (never used MuJoCo) but given the nature of the other data, I suspect "pos" is the position of the center of mass in the local frame. So for a cube it would be the point in the very center of the cube, equidistant to all faces.
Post Reply