Position actuator tunning

Discussion in 'Modeling' started by Anton Novoselov, Oct 20, 2017.

  1. Hello!

    In general what I want achieve is hand-like hinge joint chain which is controlled by explicitly setting desired angles on joints, so that the actuators on joints will drive to this angles/positions.

    So far on simple 1 joint case what works fine for me is just using position actuator on a joint. Setting stiffness to 0. And scaling both "kp" and "damping" to the same value to control the velocity at which desired angle is reached (I pass the angle through models ctrl[] in cpp code).

    Here is the model:

    Code:
    <mujoco>
    <option iterations="50" solver="PGS" gravity="0 0 0" timestep="0.02" >
    <flag contact="disable"/>
    </option>
    <compiler inertiafromgeom="true" />
    <default>
    <joint limited="false" />
    <geom density="1000" />
    </default>
    <worldbody>
      <body pos="2 0.8 0" quat="1 0 0 0">
        <geom type="box" size="0.1 0.2 0.1" pos="0 0 0" quat="1 0 0 0" />
        <body pos="0 -0.7 0.15" quat="0.707107 0 -0.707107 0">
          <geom type="box" size="0.05 0.8 0.05" pos="0 0 0" quat="1 0 0 0" />
          <joint type="hinge" pos="-0.05 0.6 0" armature="0" axis="1 0 0" name="joint_0" damping="10" stiffness="0" />
        </body>
      </body>
    </worldbody>
    <actuator>
    <position joint="joint_0" gear="1" kp="100" ctrllimited="false" forcelimited="false" />
    </actuator>
    </mujoco>
    
    The problem is if I change mass/size of the model I have to tune "kp" and "damping" a lot for every joint. Is there some mass independent way to tune it? (like springdamper timeconst I guess, but without stiffness that adds equilibrium position which I don't want). And is it the best way to achieve my goal at all?

    I haven't found any examples of position actuator, I noticed the doc mentions having both position+velocity actuator, maybe this is the better way to go? Would I be able just set angle and velocity and that would work exactly on models of different size, density, gravity and so on?
     
  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    The "springdamper" mechanism is provided for joints, and scales the stiffness and damping with the inertia. But it is not available for actuators. So you have to write the code to do it yourself. You can find the formulas for critical damping on Wikipedia.
     
    Kyokushin likes this.