rigidBodyDynamics: Simplify handling of quaternions by maintaining a unit quaternion in the joint state field 'q'

'w' is now obtained from 'v' using the relation w = sqrt(1 - |sqr(v)|)
and 'v' is stored in the joint state field 'q' and integrated in the
usual manner but corrected using quaternion transformations.
This commit is contained in:
Henry Weller
2016-04-12 21:44:34 +01:00
parent 4197cb075a
commit df1cb90dc6
41 changed files with 13 additions and 90 deletions

View File

@ -64,8 +64,7 @@ int main(int argc, char *argv[])
sphericalJoint.joints()[1]
(
quaternion(quaternion::ZYX, vector(0.3, 0, 0)),
sphericalJoint.state().q(),
sphericalJoint.state().w()
sphericalJoint.state().q()
);
// Set the gravitational acceleration
@ -90,8 +89,7 @@ int main(int argc, char *argv[])
<< t << " "
<< sphericalJoint.joints()[1]
(
sphericalJoint.state().q(),
sphericalJoint.state().w()
sphericalJoint.state().q()
).eulerAngles(quaternion::ZYX).x()
<< endl;
}