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

@@ -35,6 +35,20 @@ static btVector3 selectColor2()
void printTree(const URDFImporterInterface& u2b, int linkIndex, int indentationLevel)
{
btScalar mass;
btVector3 localInertia;
btTransform inertialFrame;
u2b.getMassAndInertia(linkIndex,mass,localInertia,inertialFrame);
std::string name = u2b.getLinkName(linkIndex);
for(int j=0;j<indentationLevel;j++)
printf(" "); //indent
printf("link %s mass=%f\n",name.c_str(),mass);
for(int j=0;j<indentationLevel;j++)
printf(" "); //indent
printf("local inertia:%f,%f,%f\n",localInertia[0],
localInertia[1],
localInertia[2]);
btAlignedObjectArray<int> childIndices;
u2b.getLinkChildIndices(linkIndex,childIndices);
@@ -46,6 +60,8 @@ void printTree(const URDFImporterInterface& u2b, int linkIndex, int indentationL
{
int childLinkIndex = childIndices[i];
std::string name = u2b.getLinkName(childLinkIndex);
for(int j=0;j<indentationLevel;j++) printf(" "); //indent
printf("child(%d).name=%s with childIndex=%d\n",(count++)+1, name.c_str(),childLinkIndex);
// first grandchild