fix issue with btMultiBody friction in combination with soft contacts (friction should not re-use normal contact cfm/erp)

implement friction anchors, position friction correction, disabled by default. Use colObj->setCollisionFlag(flag | CF_HAS_FRICTION_ANCHOR); See test/RobotClientAPI/SlopeFrictionMain.cpp. In URDF or SDF, add <friction_anchor/> in <contact> section of <link> to enable.
PhysicsServer: properly restore old activation state after releasing picked object
btMultiBodyConstraintSolver: disable flip/flop of contact/friction constraint solving by default (it breaks some internal flaky unit tests)
This commit is contained in:
Erwin Coumans
2017-03-20 10:58:07 -07:00
parent 865d37fcb5
commit 0b017b0f53
18 changed files with 299 additions and 91 deletions

View File

@@ -61,6 +61,7 @@ int main(int argc, char* argv[])
sim->setRealTimeSimulation(false);
int vidLogId = -1;
int minitaurLogId = -1;
int rotateCamera = 0;
while (sim->canSubmitCommand())
{
@@ -73,9 +74,11 @@ int main(int argc, char* argv[])
//m_keyState is a flag combination of eButtonIsDown,eButtonTriggered, eButtonReleased
for (int i=0;i<keyEvents.m_numKeyboardEvents;i++)
{
if (keyEvents.m_keyboardEvents[i].m_keyCode=='0')
b3KeyboardEvent& e = keyEvents.m_keyboardEvents[i];
if (e.m_keyCode=='0')
{
if ( keyEvents.m_keyboardEvents[i].m_keyState&eButtonTriggered)
if ( e.m_keyState&eButtonTriggered)
{
if (vidLogId < 0)
{
@@ -89,28 +92,40 @@ int main(int argc, char* argv[])
}
}
if (keyEvents.m_keyboardEvents[i].m_keyCode=='m')
if (e.m_keyCode=='m')
{
if ( minitaurLogId<0 && keyEvents.m_keyboardEvents[i].m_keyState&eButtonTriggered)
if ( minitaurLogId<0 && e.m_keyState&eButtonTriggered)
{
minitaurLogId = sim->startStateLogging(STATE_LOGGING_MINITAUR,"simlog.bin");
}
if (minitaurLogId>=0 && keyEvents.m_keyboardEvents[i].m_keyState&eButtonReleased)
if (minitaurLogId>=0 && e.m_keyState&eButtonReleased)
{
sim->stopStateLogging(minitaurLogId);
minitaurLogId=-1;
}
}
if (e.m_keyCode == 'r' && e.m_keyState&eButtonTriggered)
{
rotateCamera = 1-rotateCamera;
}
//printf("keyEvent[%d].m_keyCode = %d, state = %d\n", i,keyEvents.m_keyboardEvents[i].m_keyCode,keyEvents.m_keyboardEvents[i].m_keyState);
}
}
sim->stepSimulation();
static double yaw=0;
double distance = 10.5+9 * b3Sin(yaw);
yaw+=0.008;
sim->resetDebugVisualizerCamera(distance,yaw,20,b3MakeVector3(0,0,0.1));
if (rotateCamera)
{
static double yaw=0;
double distance = 1;
yaw+=0.1;
b3Vector3 basePos;
b3Quaternion baseOrn;
sim->getBasePositionAndOrientation(minitaurUid,basePos,baseOrn);
sim->resetDebugVisualizerCamera(distance,yaw,20,basePos);
}
b3Clock::usleep(1000.*1000.*fixedTimeStep);
}