fixed a assertion error in btReducedDeformableSolver. clean up outputs

This commit is contained in:
jingyuc
2021-10-25 17:28:19 -04:00
parent b5325a265f
commit e2f6430d19
5 changed files with 7 additions and 11 deletions

3
.gitignore vendored
View File

@@ -39,4 +39,5 @@ CTestTestFile.cmake
.vscode/
.idea/
cmake-build-debug/
cmake-build-debug/
examples/pybullet/gym/pybullet.cpython-37m-darwin.so

View File

@@ -83,8 +83,11 @@ public:
{
sim_time += internalTimeStep;
btReducedSoftBody* rsb = static_cast<btReducedSoftBody*>(getDeformableDynamicsWorld()->getSoftBodyArray()[0]);
std::ofstream myfile("fixed_node.txt", std::ios_base::app);
myfile << sim_time << "\t" << rsb->m_nodes[0].m_x[0] << "\t" << rsb->m_nodes[0].m_x[1] << "\t" << rsb->m_nodes[0].m_x[2] << "\n";
myfile << sim_time << "\t" << rsb->m_nodes[0].m_x[0] - rsb->m_x0[0][0] << "\t"
<< rsb->m_nodes[0].m_x[1] - rsb->m_x0[0][1] << "\t"
<< rsb->m_nodes[0].m_x[2] - rsb->m_x0[0][2] << "\n";
myfile.close();
}
}

View File

@@ -39,7 +39,6 @@ btScalar btReducedDeformableStaticConstraint::solveConstraint(const btContactSol
// calculate residual
btScalar residualSquare = m_impulseFactor * deltaImpulse;
residualSquare *= residualSquare;
std::cout << "residualSquare: " << residualSquare << "\n";
return residualSquare;
}
@@ -48,12 +47,7 @@ btScalar btReducedDeformableStaticConstraint::solveConstraint(const btContactSol
void btReducedDeformableStaticConstraint::applyImpulse(const btVector3& impulse)
{
// apply full space impulse
std::cout << "node: " << m_node->index << " impulse: " << impulse[0] << '\t' << impulse[1] << '\t' << impulse[2] << '\n';
m_rsb->internalApplyFullSpaceImpulse(impulse, m_ri, m_node->index, m_dt);
// get the new nodal velocity
// m_node->m_v = m_rsb->computeNodeFullVelocity(m_rsb->getInterpolationWorldTransform(), m_node->index);
// m_rsb->mapToFullVelocity(m_rsb->getInterpolationWorldTransform());
}
btVector3 btReducedDeformableStaticConstraint::getDeltaVa() const

View File

@@ -210,7 +210,7 @@ void btReducedSoftBodySolver::setConstraints(const btContactSolverInfo& infoGlob
}
}
}
btAssert(rsb->m_fixedNodes.size() == m_staticConstraints[i].size());
btAssert(rsb->m_fixedNodes.size() * 3 == m_staticConstraints[i].size());
// set Deformable Node vs. Rigid constraint
for (int j = 0; j < rsb->m_nodeRigidContacts.size(); ++j)

View File

@@ -29,7 +29,6 @@ btScalar btDeformableMultiBodyConstraintSolver::solveDeformableGroupIterations(b
int maxIterations = m_maxOverrideNumSolverIterations > infoGlobal.m_numIterations ? m_maxOverrideNumSolverIterations : infoGlobal.m_numIterations;
for (int iteration = 0; iteration < maxIterations; iteration++)
{
std::cout << "iter: " << iteration << " -------------\n";
// rigid bodies are solved using solver body velocity, but rigid/deformable contact directly uses the velocity of the actual rigid body. So we have to do the following: Solve one iteration of the rigid/rigid contact, get the updated velocity in the solver body and update the velocity of the underlying rigid body. Then solve the rigid/deformable contact. Finally, grab the (once again) updated rigid velocity and update the velocity of the wrapping solver body
// solve rigid/rigid in solver body
@@ -61,7 +60,6 @@ btScalar btDeformableMultiBodyConstraintSolver::solveDeformableGroupIterations(b
break;
}
}
std::cout << "===========new step============\n";
}
return 0.f;
}