Weird behavior when modifying geom pos in c++ api

Discussion in 'Priority support' started by florianw, Feb 26, 2019.

  1. I experience tow different behaviors:

    Case 1:
    xml file contains abody with a geom "x" with pos="0.0 0.0 0.0"
    -> setting m->geom_pos[x_id*3+0] = 42.0 during simulation has absolutely no effect


    Case 2:
    xml file contains abody with a geom "x" with pos="0.000001 0.000001 0.000001" (is non-zero)
    -> setting m->geom_pos[x_id*3+0] = 42.0 during simulation has the desired effect of shifting the geoms

    Are you somehow optimizing fusing geoms whatsoever, such that setting the pos of geoms manually has no effect anymore?
     
  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    As of MuJoCo 2.0 there is an internal compiler optimization, where "simple" bodies are flagged at compile time and processed faster at runtime. The flag is in mjModel.body_simple. If you set this to zero for a given body, your runtime changes in geom position will take effect.
     
  3. :eek: Thanks!