This commit is contained in:
Erwin Coumans
2018-05-25 08:50:23 +10:00
3 changed files with 45 additions and 27 deletions

View File

@@ -450,7 +450,7 @@ print("-----")
setup( setup(
name = 'pybullet', name = 'pybullet',
version='1.9.9', version='2.0.0',
description='Official Python Interface for the Bullet Physics SDK specialized for Robotics Simulation and Reinforcement Learning', description='Official Python Interface for the Bullet Physics SDK specialized for Robotics Simulation and Reinforcement Learning',
long_description='pybullet is an easy to use Python module for physics simulation, robotics and deep reinforcement learning based on the Bullet Physics SDK. With pybullet you can load articulated bodies from URDF, SDF and other file formats. pybullet provides forward dynamics simulation, inverse dynamics computation, forward and inverse kinematics and collision detection and ray intersection queries. Aside from physics simulation, pybullet supports to rendering, with a CPU renderer and OpenGL visualization and support for virtual reality headsets.', long_description='pybullet is an easy to use Python module for physics simulation, robotics and deep reinforcement learning based on the Bullet Physics SDK. With pybullet you can load articulated bodies from URDF, SDF and other file formats. pybullet provides forward dynamics simulation, inverse dynamics computation, forward and inverse kinematics and collision detection and ray intersection queries. Aside from physics simulation, pybullet supports to rendering, with a CPU renderer and OpenGL visualization and support for virtual reality headsets.',
url='https://github.com/bulletphysics/bullet3', url='https://github.com/bulletphysics/bullet3',

View File

@@ -32,24 +32,38 @@ bool btGjkEpaPenetrationDepthSolver::calcPenDepth( btSimplexSolverInterface& sim
(void)v; (void)v;
(void)simplexSolver; (void)simplexSolver;
// const btScalar radialmargin(btScalar(0.)); btVector3 guessVectors[] = {
btVector3(transformB.getOrigin() - transformA.getOrigin()),
btVector3(transformA.getOrigin() - transformB.getOrigin()),
btVector3(0, 0, 1),
btVector3(0, 1, 0),
btVector3(1, 0, 0),
btVector3(1, 1, 0),
btVector3(1, 1, 1),
btVector3(0, 1, 1),
btVector3(1, 0, 1),
};
int numVectors = sizeof(guessVectors) / sizeof(btVector3);
for (int i = 0; i < numVectors; i++)
{
simplexSolver.reset();
btVector3 guessVector = guessVectors[i];
btVector3 guessVector(transformB.getOrigin()-transformA.getOrigin());
btGjkEpaSolver2::sResults results; btGjkEpaSolver2::sResults results;
if (btGjkEpaSolver2::Penetration(pConvexA, transformA, if (btGjkEpaSolver2::Penetration(pConvexA, transformA,
pConvexB, transformB, pConvexB, transformB,
guessVector, results)) guessVector, results))
{ {
// debugDraw->drawLine(results.witnesses[1],results.witnesses[1]+results.normal,btVector3(255,0,0));
//resultOut->addContactPoint(results.normal,results.witnesses[1],-results.depth);
wWitnessOnA = results.witnesses[0]; wWitnessOnA = results.witnesses[0];
wWitnessOnB = results.witnesses[1]; wWitnessOnB = results.witnesses[1];
v = results.normal; v = results.normal;
return true; return true;
} else }
else
{ {
if (btGjkEpaSolver2::Distance(pConvexA, transformA, pConvexB, transformB, guessVector, results)) if (btGjkEpaSolver2::Distance(pConvexA, transformA, pConvexB, transformB, guessVector, results))
{ {
@@ -59,8 +73,12 @@ bool btGjkEpaPenetrationDepthSolver::calcPenDepth( btSimplexSolverInterface& sim
return false; return false;
} }
} }
}
//failed to find a distance/penetration
wWitnessOnA.setValue(0, 0, 0);
wWitnessOnB.setValue(0, 0, 0);
v.setValue(0, 0, 0);
return false; return false;
} }

View File

@@ -35,7 +35,7 @@ subject to the following restrictions:
btScalar gGjkEpaPenetrationTolerance = 1e-7; btScalar gGjkEpaPenetrationTolerance = 1e-7;
#else #else
#define REL_ERROR2 btScalar(1.0e-6) #define REL_ERROR2 btScalar(1.0e-6)
btScalar gGjkEpaPenetrationTolerance = 0.001; btScalar gGjkEpaPenetrationTolerance = BT_LARGE_FLOAT;
#endif #endif
//temp globals, to improve GJK/EPA/penetration calculations //temp globals, to improve GJK/EPA/penetration calculations