PyBullet loadURDF in useMaximalCoordinated=True (btRigidBody), support lower/upper limits for revolute joints.
This commit is contained in:
@@ -119,8 +119,8 @@ class btGeneric6DofSpring2Constraint* MyMultiBodyCreator::createRevoluteJoint(in
|
|||||||
dof6->setLinearLowerLimit(btVector3(0,0,0));
|
dof6->setLinearLowerLimit(btVector3(0,0,0));
|
||||||
dof6->setLinearUpperLimit(btVector3(0,0,0));
|
dof6->setLinearUpperLimit(btVector3(0,0,0));
|
||||||
|
|
||||||
dof6->setAngularUpperLimit(btVector3(-1,0,0));
|
dof6->setAngularLowerLimit(btVector3(jointLowerLimit,0,0));
|
||||||
dof6->setAngularLowerLimit(btVector3(1,0,0));
|
dof6->setAngularUpperLimit(btVector3(jointUpperLimit,0,0));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -130,8 +130,9 @@ class btGeneric6DofSpring2Constraint* MyMultiBodyCreator::createRevoluteJoint(in
|
|||||||
dof6->setLinearLowerLimit(btVector3(0,0,0));
|
dof6->setLinearLowerLimit(btVector3(0,0,0));
|
||||||
dof6->setLinearUpperLimit(btVector3(0,0,0));
|
dof6->setLinearUpperLimit(btVector3(0,0,0));
|
||||||
|
|
||||||
dof6->setAngularUpperLimit(btVector3(0,-1,0));
|
|
||||||
dof6->setAngularLowerLimit(btVector3(0,1,0));
|
dof6->setAngularLowerLimit(btVector3(0,jointLowerLimit,0));
|
||||||
|
dof6->setAngularUpperLimit(btVector3(0,jointUpperLimit,0));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
@@ -141,8 +142,9 @@ class btGeneric6DofSpring2Constraint* MyMultiBodyCreator::createRevoluteJoint(in
|
|||||||
dof6->setLinearLowerLimit(btVector3(0,0,0));
|
dof6->setLinearLowerLimit(btVector3(0,0,0));
|
||||||
dof6->setLinearUpperLimit(btVector3(0,0,0));
|
dof6->setLinearUpperLimit(btVector3(0,0,0));
|
||||||
|
|
||||||
dof6->setAngularUpperLimit(btVector3(0,0,-1));
|
|
||||||
dof6->setAngularLowerLimit(btVector3(0,0,1));
|
dof6->setAngularLowerLimit(btVector3(0,0,jointLowerLimit));
|
||||||
|
dof6->setAngularUpperLimit(btVector3(0,0,jointUpperLimit));
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -462,6 +462,8 @@ void ConvertURDF2BulletInternal(
|
|||||||
{
|
{
|
||||||
|
|
||||||
btGeneric6DofSpring2Constraint* dof6 = 0;
|
btGeneric6DofSpring2Constraint* dof6 = 0;
|
||||||
|
if (jointType == URDFRevoluteJoint && jointLowerLimit <= jointUpperLimit)
|
||||||
|
{
|
||||||
//backwards compatibility
|
//backwards compatibility
|
||||||
if (flags & CUF_RESERVED )
|
if (flags & CUF_RESERVED )
|
||||||
{
|
{
|
||||||
@@ -470,6 +472,18 @@ void ConvertURDF2BulletInternal(
|
|||||||
{
|
{
|
||||||
dof6 = creation.createRevoluteJoint(urdfLinkIndex,*linkRigidBody, *parentRigidBody, offsetInB, offsetInA,jointAxisInJointSpace,jointLowerLimit, jointUpperLimit);
|
dof6 = creation.createRevoluteJoint(urdfLinkIndex,*linkRigidBody, *parentRigidBody, offsetInB, offsetInA,jointAxisInJointSpace,jointLowerLimit, jointUpperLimit);
|
||||||
}
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
//disable joint limits
|
||||||
|
if (flags & CUF_RESERVED )
|
||||||
|
{
|
||||||
|
dof6 = creation.createRevoluteJoint(urdfLinkIndex,*parentRigidBody, *linkRigidBody, offsetInA, offsetInB,jointAxisInJointSpace,1,-1);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
dof6 = creation.createRevoluteJoint(urdfLinkIndex,*linkRigidBody, *parentRigidBody, offsetInB, offsetInA,jointAxisInJointSpace,1,-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (enableConstraints)
|
if (enableConstraints)
|
||||||
world1->addConstraint(dof6,true);
|
world1->addConstraint(dof6,true);
|
||||||
//b3Printf("Revolute/Continuous joint\n");
|
//b3Printf("Revolute/Continuous joint\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user