From 9ecd345783a2cdc076a44d514c8bea598899cd90 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Thu, 7 Sep 2017 11:40:11 -0700 Subject: [PATCH] backwards compatibility... --- .../Importers/ImportURDFDemo/URDF2Bullet.cpp | 23 +++++++++++++++---- .../Importers/ImportURDFDemo/URDFJointTypes.h | 1 + .../PhysicsServerCommandProcessor.cpp | 5 +++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/examples/Importers/ImportURDFDemo/URDF2Bullet.cpp b/examples/Importers/ImportURDFDemo/URDF2Bullet.cpp index 9ef61ddc7..9ee66c85f 100644 --- a/examples/Importers/ImportURDFDemo/URDF2Bullet.cpp +++ b/examples/Importers/ImportURDFDemo/URDF2Bullet.cpp @@ -390,8 +390,16 @@ void ConvertURDF2BulletInternal( { //b3Printf("Fixed joint\n"); - btGeneric6DofSpring2Constraint* dof6 = creation.createFixedJoint(urdfLinkIndex,*parentRigidBody, *linkRigidBody, offsetInA, offsetInB); - + btGeneric6DofSpring2Constraint* dof6 = 0; + + //backward compatibility + if (flags & URDF_ORDER_TYPED_CONSTRAINT ) + { + dof6 = creation.createFixedJoint(urdfLinkIndex,*parentRigidBody, *linkRigidBody, offsetInA, offsetInB); + } else + { + dof6 = creation.createFixedJoint(urdfLinkIndex,*linkRigidBody, *parentRigidBody, offsetInB, offsetInA); + } if (enableConstraints) world1->addConstraint(dof6,true); } @@ -417,8 +425,15 @@ void ConvertURDF2BulletInternal( } else { - btGeneric6DofSpring2Constraint* dof6 = creation.createRevoluteJoint(urdfLinkIndex,*parentRigidBody, *linkRigidBody, offsetInA, offsetInB,jointAxisInJointSpace,jointLowerLimit, jointUpperLimit); - + btGeneric6DofSpring2Constraint* dof6 = 0; + //backwards compatibility + if (flags & URDF_ORDER_TYPED_CONSTRAINT ) + { + dof6 = creation.createRevoluteJoint(urdfLinkIndex,*parentRigidBody, *linkRigidBody, offsetInA, offsetInB,jointAxisInJointSpace,jointLowerLimit, jointUpperLimit); + } else + { + dof6 = creation.createRevoluteJoint(urdfLinkIndex,*linkRigidBody, *parentRigidBody, offsetInB, offsetInA,jointAxisInJointSpace,jointLowerLimit, jointUpperLimit); + } if (enableConstraints) world1->addConstraint(dof6,true); //b3Printf("Revolute/Continuous joint\n"); diff --git a/examples/Importers/ImportURDFDemo/URDFJointTypes.h b/examples/Importers/ImportURDFDemo/URDFJointTypes.h index 2edad8617..5f470449d 100644 --- a/examples/Importers/ImportURDFDemo/URDFJointTypes.h +++ b/examples/Importers/ImportURDFDemo/URDFJointTypes.h @@ -61,6 +61,7 @@ enum UrdfCollisionFlags URDF_FORCE_CONCAVE_TRIMESH=1, URDF_HAS_COLLISION_GROUP=2, URDF_HAS_COLLISION_MASK=4, + URDF_ORDER_TYPED_CONSTRAINT=8, }; struct UrdfMaterialColor diff --git a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp index 747500bc1..a51202ee8 100644 --- a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp +++ b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp @@ -2416,7 +2416,8 @@ bool PhysicsServerCommandProcessor::processImportedObjects(const char* fileName, MyMultiBodyCreator creation(m_data->m_guiHelper); u2b.getRootTransformInWorld(rootTrans); - ConvertURDF2Bullet(u2b,creation, rootTrans,m_data->m_dynamicsWorld,useMultiBody,u2b.getPathPrefix(),flags); + flags |= URDF_ORDER_TYPED_CONSTRAINT; + ConvertURDF2Bullet(u2b,creation, rootTrans,m_data->m_dynamicsWorld,useMultiBody,u2b.getPathPrefix(),flags); @@ -2695,6 +2696,8 @@ bool PhysicsServerCommandProcessor::loadUrdf(const char* fileName, const btVecto // printf("urdf root link index = %d\n",rootLinkIndex); MyMultiBodyCreator creation(m_data->m_guiHelper); + flags |= URDF_ORDER_TYPED_CONSTRAINT; + ConvertURDF2Bullet(u2b,creation, tr,m_data->m_dynamicsWorld,useMultiBody,u2b.getPathPrefix(),flags); for (int i=0;i