Skip to content

Commit

Permalink
[core] Fix PGS cone bounds computation. (#460)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexis Duburcq <alexis.duburcq@wandercraft.eu>
  • Loading branch information
duburcqa and Alexis Duburcq authored Nov 30, 2021
1 parent 4d2ce2c commit e1ef450
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions core/src/solver/LCPSolvers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,37 @@ namespace jiminy
}
else
{
float64_t thr;
float64_t f = x[fIdx[0]];
if (fSize == 1)
float64_t thr = hi[i] * f;
if (thr > EPS)
{
thr = hi[i] * std::abs(f);
if (fSize == 1)
{
e = clamp(e, -thr, thr);
}
else
{
thr *= thr;
for (auto fIt = fIdx.begin() + 1; fIt != fIdx.end(); ++fIt)
{
f = x[*fIt];
thr -= f * f;
}
if (thr > EPS)
{
thr = std::sqrt(thr);
e = clamp(e, -thr, thr);
}
else
{
e = 0.0;
}
}
}
else
{
thr = hi[i] * f * f;
for (auto fIt = fIdx.begin() + 1; fIt != fIdx.end(); ++fIt)
{
f = x[*fIt];
thr -= f * f;
}
thr = std::sqrt(std::max(0.0, thr));
e = 0.0;
}
e = clamp(e, -thr, thr);
}

// Check if still possible to terminate after complete update
Expand Down

0 comments on commit e1ef450

Please sign in to comment.