How to asset the key frame?

Discussion in 'MuJoCo Pro Bug Reports' started by KyleSJYoo, Dec 20, 2017.

  1. <mujoco>
    <size nkey="1" />
    <asset>
    <texture type="skybox" builtin="gradient" rgb1="1 1 1" rgb2="0.6 0.8 1" width="256" height="1536"/>
    </asset>
    <worldbody>
    <light dir="0 0 -1" pos="0 0 3" diffuse=".5 .5 .5"/>
    <!-- light -->
    <geom type="plane" size="4 4 0.1" rgba="0.8 0.8 0.8 0.8"/>
    <!-- plane -->
    <body name ="trunk" pos="0 0 1.35" euler="0 0 0">
    <!-- base body -->
    <freejoint/>
    <inertial pos="0 0 0" mass="12" diaginertia="0.01 0.01 0.01"/>
    <geom type="box" size="0.1 0.3 0.2" rgba="1 0 0 1"/>
    <body name="left_thigh" pos="0 -0.325 -0.45" euler="0 0 0">
    <inertial pos="0 0 0" mass="3" diaginertia="0.01 0.01 0.01"/>
    <geom type="capsule" size="0.025 0.22" rgba=" 0 0 1 1"/>
    <joint name="L_hip" type="hinge" pos="0 0 0.25" axis="1 0 0" range='-180 180' stiffness='1' armature='0.0060'/>
    <joint name="L_upper" type="hinge" pos="0 0 0.25" axis="0 1 0" range='-180 180' stiffness='1' armature='0.0060'/>
    <body name="left_shank" pos="0 0 -0.5" euler="0 0 0">
    <inertial pos="0 0 0" mass="3" diaginertia="0.01 0.01 0.01"/>
    <geom type="capsule" size="0.025 0.22" rgba=" 0 0 1 1"/>
    <joint name="L_lower" type="hinge" pos="0 0 0.25" axis="0 1 0" range='-180 180' stiffness='1' armature='0.0060'/>
    <body name="left_wheel" pos="0 -0.05 -0.25" euler="90 0 0">
    <inertial pos="0 0 0" mass="3" diaginertia="0.01 0.01 0.01"/>
    <geom type="ellipsoid" size="0.15 0.15 0.02" rgba=" 0 1 0 1"/>
    <joint name="L_wheel" type="hinge" pos="0 0 0" axis="0 0 -1"/>
    </body>
    </body>
    </body>
    <body name="right_thigh" pos="0 0.325 -0.45" euler="0 0 0">
    <inertial pos="0 0 0" mass="3" diaginertia="0.01 0.01 0.01"/>
    <geom type="capsule" size="0.025 0.22" rgba=" 0 0 1 1"/>
    <joint name="R_hip" type="hinge" pos="0 0 0.25" axis="1 0 0" range='-180 180' stiffness='1' armature='0.0060'/>
    <joint name="R_upper" type="hinge" pos="0 0 0.25" axis="0 1 0" range='-180 180' stiffness='1' armature='0.0060'/>
    <body name="right_shank" pos="0 0 -0.5" euler="0 0 0">
    <inertial pos="0 0 0" mass="3" diaginertia="0.01 0.01 0.01"/>
    <geom type="capsule" size="0.025 0.22" rgba=" 0 0 1 1"/>
    <joint name="R_lower" type="hinge" pos="0 0 0.25" axis="0 1 0" range='-180 180' stiffness='1' armature='0.0060'/>
    <body name="right_wheel" pos="0 0.05 -0.25" euler="90 0 0">
    <inertial pos="0 0 0" mass="3" diaginertia="0.01 0.01 0.01"/>
    <geom type="ellipsoid" size="0.15 0.15 0.02" rgba=" 0 1 0 1"/>
    <joint name="R_wheel" type="hinge" pos="0 0 0" axis="0 0 -1"/>
    </body>
    </body>
    </body>
    </body>
    </worldbody>
    <actuator>
    <motor name="M_L_hip" gear="1" joint="L_hip"/>
    <motor name="M_L_upper" gear="1" joint="L_upper"/>
    <motor name="M_L_lower" gear="1" joint="L_lower"/>
    <motor name="M_L_wheel" gear="1" joint="L_wheel"/>
    <motor name="M_R_hip" gear="1" joint="R_hip"/>
    <motor name="M_R_upper" gear="1" joint="R_upper"/>
    <motor name="M_R_lower" gear="1" joint="R_lower"/>
    <motor name="M_R_wheel" gear="1" joint="R_wheel"/>
    </actuator>
    <sensor>
    <jointpos name="S_R_upper" joint="R_upper"/>
    <framepos name="F_R_wheel" objtype="body" objname="right_wheel"/>
    </sensor>
    <keyframe>
    <key time="0" qpos="0 0.524 -1.047 0 0 0.524 -1.047 0" />
    </keyframe>
    </mujoco>

    Hi, I am trying to research a biped on the wheel. For the initial joint values, I defined a keyframe at time="0" and get the initial pose by

    mju_copy(d->qpos, m->key_qpos, m->nq*1)

    But, it does not work and send message that

    Unhandled exception at 0x00afb9c0 in simulation_cpp.exe: 0xC0000005: Access violation reading location 0x00000004.

    I think the problem is around the free joint. If I erase "<freejoint />" , then the simulation is run. (I guess that the dimension of "qpos" is not 8 with the freejoint.)

    Please let me figure out the problem. Thank you.
     
  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    The free joint has 7 numbers for qpos: 3D position followed by 4D unit quaternion. Note that if you are also specifying velocities in keyframes, the free joint has 6 numbers: 3D translational velocity followed by 3D rotational velocity.