# Physics Simulation Forum

 Page 1 of 1 [ 4 posts ]
 Print view Previous topic | Next topic
Author Message
 Posted: Wed May 17, 2017 3:11 am

Joined: Fri Aug 12, 2016 5:46 am
Posts: 10
I read K.Erlenben book <<Stable,Robust And Verstile>> Chapter 6 to learn the PGS in Bullet

When I see the src code in Bullet, I think the Result of the Equation is the Constraint Force Fc*deltaT = dP (delta Impulse).
But I can't understand the param 'Kcfm' in the formulation above,constraint force mixing,it's a diagonal matrix in vector form

Code:
void tbSequentialImpulseConstraintSolver::ResolveSingleConstraintRowLowerLimit(tbSolverBody& body1, tbSolverBody& body2, const tbSolverConstraint& c)
{
tbScalar deltaImpulse = c.m_rhs - tbScalar(c.m_appliedImpulse)*c.m_cfm;
const tbScalar deltaVel1Dotn = c.m_contactNormal.Dot(body1.m_deltaLinearVelocity) + c.m_relpos1CrossNormal.Dot(body1.m_deltaAngularVelocity);
const tbScalar deltaVel2Dotn = -c.m_contactNormal.Dot(body2.m_deltaLinearVelocity) + c.m_relpos2CrossNormal.Dot(body2.m_deltaAngularVelocity);

deltaImpulse -= deltaVel1Dotn*c.m_jacDiagABInv;
deltaImpulse -= deltaVel2Dotn*c.m_jacDiagABInv;

const tbScalar sum = tbScalar(c.m_appliedImpulse) + deltaImpulse;
if (sum < c.m_lowerLimit)
{
deltaImpulse = c.m_lowerLimit - c.m_appliedImpulse;
c.m_appliedImpulse = c.m_lowerLimit;
}
else
{
c.m_appliedImpulse = sum;
}

if (body1.m_invMass > tbScalar(0.))
body1.ApplyImpulse(c.m_contactNormal*body1.m_invMass, c.m_angularComponentA, deltaImpulse);
if (body2.m_invMass > tbScalar(0.))
body2.ApplyImpulse(-c.m_contactNormal*body2.m_invMass, c.m_angularComponentB, deltaImpulse);
}

Code:
tbScalar restitution = 0.f;
tbScalar positionalError = solverConstraint.m_rhs;//already filled in by getConstraintInfo2
tbScalar   velocityError = restitution - rel_vel;// * damping;
tbScalar   penetrationImpulse = positionalError*solverConstraint.m_jacDiagABInv;
tbScalar   velocityImpulse = velocityError *solverConstraint.m_jacDiagABInv;
solverConstraint.m_rhs = penetrationImpulse + velocityImpulse;
solverConstraint.m_appliedImpulse = 0.f;

In the Formulation above,I'm clear about the posErr and velocityErr,But Berror doesn't have the param 'restitution',
so what's the meaning of 'restitution' and which paper is about it.

Last edited by Jack2016 on Fri May 19, 2017 5:23 am, edited 3 times in total.

Top

 Posted: Thu May 18, 2017 7:49 pm

Joined: Sun Jul 03, 2005 4:06 pm
Posts: 872
Location: Kirkland, WA
Top

 Posted: Fri May 19, 2017 4:48 am

Joined: Fri Aug 12, 2016 5:46 am
Posts: 10
Dirk Gregorius wrote:
http://box2d.org/files/GDC2011/GDC2011_Catto_Erin_Soft_Constraints.pdf

Thanks, Drik

The Paper <<Soft Constraints>> by Erin is very helpful to me.

I also find the entire derivation about softness post by Erin https://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=4&t=1354

v2new = v2damaged + invM * JT * dP
J * (v2damaged + invM * JT * dP) + softness * P + softness * dP + bias = 0

(J * invM * JT + softness) * dP = -(J * v2damaged + softness * P + bias)

the softness is CFM

But I'm still not clear about the parameter 'restitution' which is about damping.
'restitution' is not in the Formula above,any one can make it clear ? thanks

Top

 Posted: Fri May 19, 2017 5:27 pm

Joined: Sun Jul 03, 2005 4:06 pm
Posts: 872
Location: Kirkland, WA
This might be unrelated to the soft parameters. Normally we solve for a relative velocity of zero at a contact point or limit, but you can also imagine to solve to revert some of the approaching velocity to model bouncy contacts (e.g. a ball) or limits.

https://en.wikipedia.org/wiki/Coefficie ... estitution

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 4 posts ]

#### Who is online

Users browsing this forum: No registered users and 4 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ BULLET PHYSICS LIBRARY USERS    General Bullet Physics Support and Feedback    Release Announcements    Applications, Games, Demos or Movies using Bullet PHYSICS AUTHORING TOOLS, SERIALIZATION AND STANDARDS    Physics authoring tools, serialization, standards and related topics RESEARCH AND DEVELOPMENT IN COLLISION DETECTION & PHYSICS. Don't post Bullet support questions here!    Research and development discussion about Collision Detection and Physics Simulation    Links, Papers, Libraries, Demos, Movies, Comparisons       Non-technical forum and license/patent discussion    Career Opportunities