1
$\begingroup$

MuJoCo needs me to enter the position of the inertial frame and the diagonal of the inertial matrix, (if I understand correctly). I'm not sure how to get this information from SolidWorks.
This object is what I'm working with.

I'm not sure if I entered the inertia information correctly and maybe there is another factor to this model to simulate the real life physics. Maybe there is a problem with the units for the inertia. I don't know.

I have an actuator in the hinge of this object. It tends to make the object fly around like a butterfly. I expect the object to fall to the floor and open and close like a normal egg slicer with an actuator with no mass in the hinge.

Here are the docs for inertial in MuJoCo.
I don't know what an "inertial position" is exactly. This is what it says, "pos: real(3), required Position of the inertial frame. This attribute is required even when the inertial properties can be inferred from geoms. This is because the presence of the inertial element itself disabled the automatic inference mechanism."

This is my code, and below it is a picture of the information from SolidWorks.

<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="0.49" diaginertia="0.01 0.02 0.02"/>

            <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="0 0 0.01" mass="0.70" diaginertia="0.02 0.02 0.03"/>
            </body>
        </body>
    </worldbody>

    <actuator>
        <motor name="hinge" gear="100" joint="hinge"/>
    </actuator>
</mujoco>  

enter image description here

$\endgroup$
2
  • $\begingroup$ I expect the object to fall to the floor ... that expectation is unclear ... shouldn't you expect it to sit on a table, or on a counter? $\endgroup$
    – jsotola
    Feb 20 at 20:04
  • $\begingroup$ When MuJoCo starts the object is dropped. You can make it so there is no gravity and no floor. I think the default is for models or objects drop to a floor/ ground/ plane to see what kind of physics the environment has. $\endgroup$
    – Ant
    Feb 20 at 23:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.