make Bullet URDF parser more similar to the ROS URDF parser. There is still a difference in ordering of links,

due to the use of different hash-map implementations, with a difference in iterator order
(btHashMap versus std::hashmap)
This commit is contained in:
erwincoumans
2015-06-29 21:30:44 -07:00
parent 3fbe9f63ef
commit e7bafbc71c
7 changed files with 52 additions and 11 deletions

View File

@@ -10,7 +10,7 @@
#include "BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.h"
#include "../CommonInterfaces/CommonParameterInterface.h"
#include "ROSURDFImporter.h"
//#include "BulletURDFImporter.h"
#include "BulletURDFImporter.h"
#include "URDF2Bullet.h"
@@ -195,15 +195,28 @@ void ImportUrdfSetup::initPhysics()
//now print the tree using the new interface
//BulletURDFImporter u2b(m_guiHelper);
ROSURDFImporter u2b(m_guiHelper);
URDFImporterInterface* bla=0;
static bool newURDF = false;
newURDF = !newURDF;
if (newURDF)
{
b3Printf("using new URDF\n");
bla = new BulletURDFImporter(m_guiHelper);
} else
{
b3Printf("using ROS URDF\n");
bla = new ROSURDFImporter(m_guiHelper);
}
URDFImporterInterface& u2b = *bla;
bool loadOk = u2b.loadURDF(m_fileName);
if (loadOk)
{
u2b.printTree();
printTree(u2b,u2b.getRootLinkIndex());
//u2b.printTree();
btTransform identityTrans;
identityTrans.setIdentity();
@@ -227,8 +240,8 @@ void ImportUrdfSetup::initPhysics()
{
//create motors for each btMultiBody joint
for (int i=0;i<mb->getNumLinks();i++)
int numLinks = mb->getNumLinks();
for (int i=0;i<numLinks;i++)
{
int mbLinkIndex = i;
if (mb->getLink(mbLinkIndex).m_jointType==btMultibodyLink::eRevolute
@@ -263,7 +276,8 @@ void ImportUrdfSetup::initPhysics()
if (1)
{
//create motors for each generic joint
for (int i=0;i<creation.getNum6DofConstraints();i++)
int num6Dof = creation.getNum6DofConstraints();
for (int i=0;i<num6Dof;i++)
{
btGeneric6DofSpring2Constraint* c = creation.get6DofConstraint(i);
if (c->getUserConstraintPtr())