From 0ad3fade4e0d806591a9e75fbed1c0eb54e9ee9b Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Fri, 12 May 2017 09:38:17 -0700 Subject: [PATCH 1/2] physicsClientId always comes last for each pybullet command --- examples/pybullet/pybullet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/pybullet/pybullet.c b/examples/pybullet/pybullet.c index 372b281a2..4738f5ddb 100644 --- a/examples/pybullet/pybullet.c +++ b/examples/pybullet/pybullet.c @@ -5520,8 +5520,8 @@ static PyObject* pybullet_calculateInverseKinematics(PyObject* self, PyObject* restPosesObj = 0; PyObject* jointDampingObj = 0; - static char* kwlist[] = {"bodyIndex", "endEffectorLinkIndex", "targetPosition", "targetOrientation", "lowerLimits", "upperLimits", "jointRanges", "restPoses", "physicsClientId", "jointDamping", NULL}; - if (!PyArg_ParseTupleAndKeywords(args, keywds, "iiO|OOOOOiO", kwlist, &bodyIndex, &endEffectorLinkIndex, &targetPosObj, &targetOrnObj, &lowerLimitsObj, &upperLimitsObj, &jointRangesObj, &restPosesObj, &physicsClientId, &jointDampingObj)) + static char* kwlist[] = {"bodyIndex", "endEffectorLinkIndex", "targetPosition", "targetOrientation", "lowerLimits", "upperLimits", "jointRanges", "restPoses", "jointDamping", "physicsClientId", NULL}; + if (!PyArg_ParseTupleAndKeywords(args, keywds, "iiO|OOOOOiO", kwlist, &bodyIndex, &endEffectorLinkIndex, &targetPosObj, &targetOrnObj, &lowerLimitsObj, &upperLimitsObj, &jointRangesObj, &restPosesObj, &jointDampingObj, &physicsClientId)) { return NULL; } From 3bdc60c05058bc606881bd475dabade443affd6c Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Fri, 12 May 2017 11:18:33 -0700 Subject: [PATCH 2/2] fix pybullet inversekinematics argument order (O/i) add spinning friction to some tutorial --- examples/ExtendedTutorials/InclinedPlane.cpp | 15 +++++++++++++++ examples/pybullet/pybullet.c | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/examples/ExtendedTutorials/InclinedPlane.cpp b/examples/ExtendedTutorials/InclinedPlane.cpp index 2c36f8ffa..343ebc3ae 100644 --- a/examples/ExtendedTutorials/InclinedPlane.cpp +++ b/examples/ExtendedTutorials/InclinedPlane.cpp @@ -36,6 +36,9 @@ static btScalar gBoxRestitution = 0; // set box restitution to 0 static btScalar gSphereFriction = 1; // set sphere friction to 1 static btScalar gSphereRollingFriction = 1; // set sphere rolling friction to 1 +static btScalar gSphereSpinningFriction = 0.3; // set sphere spinning friction to 0.3 + + static btScalar gSphereRestitution = 0; // set sphere restitution to 0 @@ -149,6 +152,16 @@ void InclinedPlaneExample::initPhysics() m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider); } + { // create slider to change the sphere rolling friction + SliderParams slider("Sphere Spinning",&gSphereSpinningFriction); + slider.m_minVal=0; + slider.m_maxVal=2; + slider.m_clampToNotches = false; + slider.m_callback = onSphereRestitutionChanged; + m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider); + } + + { // create slider to change the sphere restitution SliderParams slider("Sphere Restitution",&gSphereRestitution); slider.m_minVal=0; @@ -240,6 +253,8 @@ void InclinedPlaneExample::initPhysics() gSphere->setFriction(gSphereFriction); gSphere->setRestitution(gSphereRestitution); gSphere->setRollingFriction(gSphereRollingFriction); + gSphere->setSpinningFriction(gSphereSpinningFriction); + } m_guiHelper->autogenerateGraphicsObjects(m_dynamicsWorld); diff --git a/examples/pybullet/pybullet.c b/examples/pybullet/pybullet.c index 4738f5ddb..995110b81 100644 --- a/examples/pybullet/pybullet.c +++ b/examples/pybullet/pybullet.c @@ -5521,7 +5521,7 @@ static PyObject* pybullet_calculateInverseKinematics(PyObject* self, PyObject* jointDampingObj = 0; static char* kwlist[] = {"bodyIndex", "endEffectorLinkIndex", "targetPosition", "targetOrientation", "lowerLimits", "upperLimits", "jointRanges", "restPoses", "jointDamping", "physicsClientId", NULL}; - if (!PyArg_ParseTupleAndKeywords(args, keywds, "iiO|OOOOOiO", kwlist, &bodyIndex, &endEffectorLinkIndex, &targetPosObj, &targetOrnObj, &lowerLimitsObj, &upperLimitsObj, &jointRangesObj, &restPosesObj, &jointDampingObj, &physicsClientId)) + if (!PyArg_ParseTupleAndKeywords(args, keywds, "iiO|OOOOOOi", kwlist, &bodyIndex, &endEffectorLinkIndex, &targetPosObj, &targetOrnObj, &lowerLimitsObj, &upperLimitsObj, &jointRangesObj, &restPosesObj, &jointDampingObj, &physicsClientId)) { return NULL; }