# QPOS and QVEL description

Discussion in 'Simulation' started by Alexey Maslov, May 7, 2020.

1. Please give the qvel and qpos full description. I can't find the accurate information about these (inc. the official documetation).

For example the qpos of object
[-4.94039155e-06 -4.65361984e-07 1.72845264e-03 9.99999944e-01 -3.39572142e-07 -3.33721234e-04 -9.11633641e-09 7.09530773e-04].
According to the forum information 0:2 is position, 3:6 is quaternion position. And what is qpos?
1. Xpos (get_body_xpos) of main body is: [-4.92470031e-06 -4.98869331e-07 1.72604029e-03] that means the qpos[0:2] is really the object position.
2. Xquat (get_body_xquat) of main body is: [ 9.99999944e-01 -3.65748081e-07 -3.33730850e-04 -1.04041401e-08] that means the qpos[3:6] is really the rotation quaterion.
3. And what is qpos? I have no idea and spent on it lot of time.
Lets go to qvel.
That object has a qvel [-5.58099964e-04 -3.81232796e-05 1.75899364e-01 -5.07648514e-05 -8.90142672e-02 -1.97177224e-06 9.44856324e-02].
1. Xvelp (get_body_xvelp) of main object is [-5 .58099964e-04 -3.81232796e-05 1.75899364e-01]
2. Xvelr (get_body_xvelr) of main object is [-5.07653980e-05 -8.90142672e-02 -1.94054242e-06]. its in euler not quaterion. Am i right?

3. And what is qvel?
Thanks!

2. The documentation is very clear about those quantities. Check what
int nq;// number of generalized coordinates = dim(qpos)
and
int nv;// number of degrees of freedom = dim(qvel).
You might even incorrectly access memory.
Other than that you should provide the model you are referring to.

3. Thanks, the model is

<worldbody>
<camera name="track" mode="trackcom" pos="0 -7 2" xyaxes="1 0 0 0 0 1"/>
<light cutoff="100" diffuse="1 1 1" dir="-0 0 -1.3" directional="true" exponent="1" pos="0 0 1.3" specular=".1 .1 .1"/>
<geom conaffinity="1" condim="3" material="MatPlane" name="floor" pos="0 0 0" rgba="0.8 0.9 0.8 1" size="40 40 0.1" type="plane"/>
<body name="torso" pos="0 0 0">
<freejoint />
<!-- joint armature="0" damping="0" limited="false" name="root" pos="0 0 0" stiffness="0" type="free"/-->
<geom name="platform" type="box" pos="0 0 .15" size=".134 .3 .05" density="400"/>
<geom name="holder" type="box" pos="0 0 .2" size=".6 .025 .025" density="400"/>
<body name="balansier" pos="0 0 .35" >
<joint name="balansierjoint" pos="0 0 0" type="slide" axis="1 0 0" range="-0.25 0.25" limited="true"/>
<geom name="balancierbox" type="box" size=".3 .3 .2" rgba=".8 .2 .1 1" density="300" />
</body>
<geom name="wheel1" size="0.41 0.05 0.41" pos="0 -.37 0.41" type="ellipsoid" density="500"/>
<geom name="wheel2" size="0.41 0.05 0.41" pos="0 .37 0.41" type="ellipsoid" density="500" />
</body>
</worldbody>

Thera are no clear documentation, especially for mujoco_py. You can check it yourself- https://openai.github.io/mujoco-py/build/html/reference.html

4. And what is qpos?
Well you have an additional joint in your xml so obviously its that.

<joint name="balansierjoint" pos="0 0 0" type="slide" axis="1 0 0" range="-0.25 0.25" limited="true"/>

The mujoco documentation is very clear on what contributes to qpos and qvel
http://www.mujoco.org/book/XMLreference.html#joint