Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use OPENSIM_ASSERT in ConstantCurvatureJoint::ConstantCurvatureJointImpl #3614

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions OpenSim/Simulation/SimbodyEngine/ConstantCurvatureJoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Vec3 OpenSim::ConstantCurvatureJoint::clamp(const SimTK::Vec3& q) {
"to unphysical behavior. Please adjust your model "
"or simulation to avoid this state.",
pos(0), bound));
OPENSIM_ASSERT_FRMOBJ(false);
OPENSIM_ASSERT(false);
pos(0) = bound;
}
if (pos(0) < -bound) {
Expand All @@ -67,7 +67,7 @@ Vec3 OpenSim::ConstantCurvatureJoint::clamp(const SimTK::Vec3& q) {
"to unphysical behavior. Please adjust your model "
"or simulation to avoid this state.",
pos(0), -bound));
OPENSIM_ASSERT_FRMOBJ(false);
OPENSIM_ASSERT(false);
pos(0) = -bound;
}
if (pos(1) > bound) {
Expand All @@ -78,7 +78,7 @@ Vec3 OpenSim::ConstantCurvatureJoint::clamp(const SimTK::Vec3& q) {
"to unphysical behavior. Please adjust your model "
"or simulation to avoid this state.",
pos(1), bound));
OPENSIM_ASSERT_FRMOBJ(false);
OPENSIM_ASSERT(false);
pos(1) = bound;
}
if (pos(1) < -bound) {
Expand All @@ -89,7 +89,7 @@ Vec3 OpenSim::ConstantCurvatureJoint::clamp(const SimTK::Vec3& q) {
"to unphysical behavior. Please adjust your model "
"or simulation to avoid this state.",
pos(1), -bound));
OPENSIM_ASSERT_FRMOBJ(false);
OPENSIM_ASSERT(false);
pos(1) = -bound;
}
if (pos(2) > bound) {
Expand All @@ -100,7 +100,7 @@ Vec3 OpenSim::ConstantCurvatureJoint::clamp(const SimTK::Vec3& q) {
"to unphysical behavior. Please adjust your model "
"or simulation to avoid this state.",
pos(2), bound));
OPENSIM_ASSERT_FRMOBJ(false);
OPENSIM_ASSERT(false);
pos(2) = bound;
}
if (pos(2) < -bound) {
Expand All @@ -111,7 +111,7 @@ Vec3 OpenSim::ConstantCurvatureJoint::clamp(const SimTK::Vec3& q) {
"to unphysical behavior. Please adjust your model "
"or simulation to avoid this state.",
pos(2), -bound));
OPENSIM_ASSERT_FRMOBJ(false);
OPENSIM_ASSERT(false);
pos(2) = -bound;
}
return pos;
Expand Down Expand Up @@ -205,7 +205,7 @@ Mat33 OpenSim::ConstantCurvatureJoint::eulerXZYToMatrixGrad(
ret(1, 2) = -(-sy) * sx + cx * (cy)*sz;
ret(2, 2) = cx * (-sy) + sx * (cy)*sz;
} else {
OPENSIM_ASSERT_FRMOBJ(false);
OPENSIM_ASSERT(false);
}

return ret;
Expand Down Expand Up @@ -247,7 +247,7 @@ Mat63 OpenSim::ConstantCurvatureJoint::getEulerJacobian(const Vec3& q) {

Mat63 OpenSim::ConstantCurvatureJoint::getEulerJacobianDerivWrtPos(
const Vec3& q, int index) {
OPENSIM_ASSERT_FRMOBJ(index < 3);
OPENSIM_ASSERT(index < 3);

Mat63 DJ_Dq;
DJ_Dq.setToZero();
Expand Down Expand Up @@ -678,10 +678,10 @@ class ConstantCurvatureJointImpl
OpenSim::ConstantCurvatureJoint::clamp(q + neutralPos), length);
Vec6 result = J * Vec3(u[0], u[1], u[2]);

OPENSIM_ASSERT_FRMOBJ(!q.isNaN());
OPENSIM_ASSERT_FRMOBJ(!J.isNaN());
OPENSIM_ASSERT_FRMOBJ(!J.isInf());
OPENSIM_ASSERT_FRMOBJ(!result.isNaN());
OPENSIM_ASSERT(!q.isNaN());
OPENSIM_ASSERT(!J.isNaN());
OPENSIM_ASSERT(!J.isInf());
OPENSIM_ASSERT(!result.isNaN());

return SpatialVec(result.getSubVec<3>(0), result.getSubVec<3>(3));
}
Expand All @@ -699,10 +699,10 @@ class ConstantCurvatureJointImpl

Vec3 result = J.transpose() * rawSpatial;

OPENSIM_ASSERT_FRMOBJ(!q.isNaN());
OPENSIM_ASSERT_FRMOBJ(!J.isNaN());
OPENSIM_ASSERT_FRMOBJ(!J.isInf());
OPENSIM_ASSERT_FRMOBJ(!result.isNaN());
OPENSIM_ASSERT(!q.isNaN());
OPENSIM_ASSERT(!J.isNaN());
OPENSIM_ASSERT(!J.isInf());
OPENSIM_ASSERT(!result.isNaN());

Vec3::updAs(f) = result;
}
Expand All @@ -722,11 +722,11 @@ class ConstantCurvatureJointImpl
dq, length);
Vec6 result = dJ * Vec3(u[0], u[1], u[2]);

OPENSIM_ASSERT_FRMOBJ(!q.isNaN());
OPENSIM_ASSERT_FRMOBJ(!dq.isNaN());
OPENSIM_ASSERT_FRMOBJ(!dJ.isNaN());
OPENSIM_ASSERT_FRMOBJ(!dJ.isInf());
OPENSIM_ASSERT_FRMOBJ(!result.isNaN());
OPENSIM_ASSERT(!q.isNaN());
OPENSIM_ASSERT(!dq.isNaN());
OPENSIM_ASSERT(!dJ.isNaN());
OPENSIM_ASSERT(!dJ.isInf());
OPENSIM_ASSERT(!result.isNaN());

return SpatialVec(result.getSubVec<3>(0), result.getSubVec<3>(3));
}
Expand All @@ -748,24 +748,24 @@ class ConstantCurvatureJointImpl

Vec3 result = dJ.transpose() * rawSpatial;

OPENSIM_ASSERT_FRMOBJ(!q.isNaN());
OPENSIM_ASSERT_FRMOBJ(!dq.isNaN());
OPENSIM_ASSERT_FRMOBJ(!dJ.isNaN());
OPENSIM_ASSERT_FRMOBJ(!dJ.isInf());
OPENSIM_ASSERT_FRMOBJ(!result.isNaN());
OPENSIM_ASSERT(!q.isNaN());
OPENSIM_ASSERT(!dq.isNaN());
OPENSIM_ASSERT(!dJ.isNaN());
OPENSIM_ASSERT(!dJ.isInf());
OPENSIM_ASSERT(!result.isNaN());

Vec3::updAs(f) = result;
}

void setQToFitTransform(
const State&, const Transform& X_FM, int nq, Real* q) const {
OPENSIM_ASSERT_FRMOBJ(false);
OPENSIM_ASSERT(false);
Vec3::updAs(q) = X_FM.p();
}

void setUToFitVelocity(
const State&, const SpatialVec& V_FM, int nu, Real* u) const {
OPENSIM_ASSERT_FRMOBJ(false);
OPENSIM_ASSERT(false);
Vec3::updAs(u) = V_FM[1];
}

Expand Down