Skip to content

Commit

Permalink
Fix incorrect LCP construction in JointConstraint (#1596)
Browse files Browse the repository at this point in the history
  • Loading branch information
jslee02 committed Aug 22, 2021
1 parent e80fee6 commit 1093ec4
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions dart/constraint/JointConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,14 +400,33 @@ void JointConstraint::getInformation(ConstraintInfo* lcp)
const int dof = static_cast<int>(mJoint->getNumDofs());
for (int i = 0; i < dof; ++i)
{
assert(lcp->w[index] == 0.0);
if (!mActive[i])
continue;

#ifndef NDEBUG // debug
if (std::abs(lcp->w[index]) > 1e-6)
{
dterr << "Invalid " << index
<< "-th slack variable. Expected: 0.0. Actual: "
<< lcp->w[index] << ".\n";
assert(false);
}
#endif

lcp->b[index] = mDesiredVelocityChange[i];

lcp->lo[index] = mImpulseLowerBound[i];
lcp->hi[index] = mImpulseUpperBound[i];

assert(lcp->findex[index] == -1);
#ifndef NDEBUG // debug
if (lcp->findex[index] != -1)
{
dterr << "Invalid " << index
<< "-th friction index. Expected: -1. Actual: "
<< lcp->findex[index] << ".\n";
assert(false);
}
#endif

if (mLifeTime[i])
lcp->x[index] = mOldX[i];
Expand Down

0 comments on commit 1093ec4

Please sign in to comment.