Scalar-first convention
Q=(w,x,y,z) Identity: (1,0,0,0)
Q and −Q represent the same orientation.
Q=(cos(θ/2),nsin(θ/2)) The half-angle is essential.
Body angular velocity
Q˙=21Q⊗(0,ωB) Qk+1=Qk⊗ExpQ(ΔtωB) Quarter-turn check
Q=(2/2,0,0,2/2) A positive z quarter-turn maps x to y.
Configuration operations
mj_integratePos updates qpos from tangent velocity.
mj_differentiatePos computes a tangent difference.
Check
Identity and negative identity have zero physical attitude error.
What does raw subtraction report?