Modify the joint damping input check, and output error message when it doesn't pass the size check. Modify the kuka grasping example accordingly. Setting joint damping in this example was a no-op before.
This commit is contained in:
@@ -34,7 +34,7 @@ class Kuka:
|
|||||||
#restposes for null space
|
#restposes for null space
|
||||||
self.rp=[0,0,0,0.5*math.pi,0,-math.pi*0.5*0.66,0]
|
self.rp=[0,0,0,0.5*math.pi,0,-math.pi*0.5*0.66,0]
|
||||||
#joint damping coefficents
|
#joint damping coefficents
|
||||||
self.jd=[0.1,0.1,0.1,0.1,0.1,0.1,0.1]
|
self.jd=[0.00001,0.00001,0.00001,0.00001,0.00001,0.00001,0.00001,0.00001,0.00001,0.00001,0.00001,0.00001,0.00001,0.00001]
|
||||||
self.reset()
|
self.reset()
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
|
|||||||
@@ -6735,16 +6735,32 @@ static PyObject* pybullet_calculateInverseKinematics(PyObject* self,
|
|||||||
hasNullSpace = 1;
|
hasNullSpace = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numJoints && (szJointDamping == numJoints))
|
if (szJointDamping > 0)
|
||||||
{
|
{
|
||||||
int szInBytes = sizeof(double) * numJoints;
|
// We allow the number of joint damping values to be larger than
|
||||||
int i;
|
// the number of degrees of freedom (DOFs). On the server side, it does
|
||||||
jointDamping = (double*)malloc(szInBytes);
|
// the check and only sets joint damping for all DOFs.
|
||||||
for (i = 0; i < numJoints; i++)
|
// We can use the number of DOFs here when that is exposed. Since the
|
||||||
|
// number of joints is larger than the number of DOFs (we assume the
|
||||||
|
// joint is either fixed joint or one DOF joint), it is safe to use
|
||||||
|
// number of joints here.
|
||||||
|
if (szJointDamping < numJoints)
|
||||||
{
|
{
|
||||||
jointDamping[i] = pybullet_internalGetFloatFromSequence(jointDampingObj, i);
|
PyErr_SetString(SpamError,
|
||||||
|
"calculateInverseKinematics the size of input joint damping values is smaller than the number of joints.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int szInBytes = sizeof(double) * szJointDamping;
|
||||||
|
int i;
|
||||||
|
jointDamping = (double*)malloc(szInBytes);
|
||||||
|
for (i = 0; i < szJointDamping; i++)
|
||||||
|
{
|
||||||
|
jointDamping[i] = pybullet_internalGetFloatFromSequence(jointDampingObj, i);
|
||||||
|
}
|
||||||
|
hasJointDamping = 1;
|
||||||
}
|
}
|
||||||
hasJointDamping = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasPos)
|
if (hasPos)
|
||||||
|
|||||||
Reference in New Issue
Block a user