Changing Mass of Object during Simulation

Discussion in 'Simulation' started by Nikola, Feb 27, 2020.

  1. Hii

    I use MuJoCo with the mujoco_py wrapper and I currently am trying to change the mass of an object during the simulation.

    I do this by changing the body mass of the object (even though in the xml file it is defined in the geom)
    self.sim.model.body_mass[body_id] = 10

    However, the object (a puck on a table) penetrates the table. If I change the weight before running the simulation in the .xml file it does not happen.

    I tried to follow this post (http://www.mujoco.org/forum/index.p...meters-of-a-model-be-changed-on-the-fly.3354/) and called mj_setConst() but it still does penetrate the table.

    Any idea what the problem is? Do I have to change also the solver param's or damping / stiffness?

    This is the xml code of the object:
    <body name="object0" pos="0.025 0.025 0.02">
    <joint name="object0:joint" type="free" springdamper="1 1"></joint>
    <geom size="0.025 0.02" type="cylinder" solimp="0.99 0.99 0.01" solref="0.01 1" condim="3" name="object0" material="puck_mat" friction="0.1 0.005 0.0001" mass="1"></geom>
    <site name="object0" pos="0 0 0" size="0.02 0.02 0.02" rgba="1 0 0 1" type="sphere"></site>
    </body>


    Thank you, Nikola
     

    Attached Files: