Commit 315a1baa authored by Henry Weller's avatar Henry Weller
Browse files

rigidBodyDynamics: Simplify handling of quaternions by maintaining a unit...

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.
parent 2d2ecf91
......@@ -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;
}
......
......@@ -85,7 +85,6 @@ void Foam::RBD::joints::Pa::jcalc
(
joint::XSvc& J,
const scalarField& q,
const scalarField& w,
const scalarField& qDot
) const
{
......
......@@ -92,7 +92,6 @@ public:
(
joint::XSvc& J,
const scalarField& q,
const scalarField& w,
const scalarField& qDot
) const;
......
......@@ -84,7 +84,6 @@ void Foam::RBD::joints::Px::jcalc
(
joint::XSvc& J,
const scalarField& q,
const scalarField& w,
const scalarField& qDot
) const
{
......
......@@ -92,7 +92,6 @@ public:
(
joint::XSvc& J,
const scalarField& q,
const scalarField& w,
const scalarField& qDot
) const;
};
......
......@@ -88,7 +88,6 @@ void Foam::RBD::joints::Pxyz::jcalc
(
joint::XSvc& J,
const scalarField& q,
const scalarField& w,
const scalarField& qDot
) const
{
......
......@@ -92,7 +92,6 @@ public:
(
joint::XSvc& J,
const scalarField& q,
const scalarField& w,
const scalarField& qDot
) const;
};
......
......@@ -84,7 +84,6 @@ void Foam::RBD::joints::Py::jcalc
(
joint::XSvc& J,
const scalarField& q,
const scalarField& w,
const scalarField& qDot
) const
{
......
......@@ -92,7 +92,6 @@ public:
(
joint::XSvc& J,
const scalarField& q,
const scalarField& w,
const scalarField& qDot
) const;
};
......
......@@ -84,7 +84,6 @@ void Foam::RBD::joints::Pz::jcalc
(
joint::XSvc& J,
const scalarField& q,
const scalarField& w,
const scalarField& qDot
) const
{
......
......@@ -92,7 +92,6 @@ public:
(
joint::XSvc& J,
const scalarField& q,
const scalarField& w,
const scalarField& qDot
) const;
};
......
......@@ -85,7 +85,6 @@ void Foam::RBD::joints::Ra::jcalc
(
joint::XSvc& J,
const scalarField& q,
const scalarField& w,
const scalarField& qDot
) const
{
......
......@@ -92,7 +92,6 @@ public:
(
joint::XSvc& J,
const scalarField& q,
const scalarField& w,
const scalarField& qDot
) const;
......
......@@ -94,11 +94,10 @@ void Foam::RBD::joints::Rs::jcalc
(
joint::XSvc& J,
const scalarField& q,
const scalarField& w,
const scalarField& qDot
) const
{
J.X.E() = operator()(q, w).R().T();
J.X.E() = operator()(q).R().T();
J.X.r() = Zero;
J.S = Zero;
......
......@@ -97,7 +97,6 @@ public:
(
joint::XSvc& J,
const scalarField& q,
const scalarField& w,
const scalarField& qDot
) const;
};
......
......@@ -84,7 +84,6 @@ void Foam::RBD::joints::Rx::jcalc
(
joint::XSvc& J,
const scalarField& q,
const scalarField& w,
const scalarField& qDot
) const
{
......
......@@ -92,7 +92,6 @@ public:
(
joint::XSvc& J,
const scalarField& q,
const scalarField& w,
const scalarField& qDot
) const;
};
......
......@@ -88,7 +88,6 @@ void Foam::RBD::joints::Rxyz::jcalc
(
joint::XSvc& J,
const scalarField& q,
const scalarField& w,
const scalarField& qDot
) const
{
......
......@@ -93,7 +93,6 @@ public:
(
joint::XSvc& J,
const scalarField& q,
const scalarField& w,
const scalarField& qDot
) const;
};
......
......@@ -84,7 +84,6 @@ void Foam::RBD::joints::Ry::jcalc
(
joint::XSvc& J,
const scalarField& q,
const scalarField& w,
const scalarField& qDot
) const
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment