further work on urdfEditor.py, fix some serialization issues
This commit is contained in:
@@ -49,7 +49,8 @@ ATTRIBUTE_ALIGNED16(struct) BulletURDFInternalData
|
||||
btHashMap<btHashInt,UrdfMaterialColor> m_linkColors;
|
||||
btAlignedObjectArray<btCollisionShape*> m_allocatedCollisionShapes;
|
||||
mutable btAlignedObjectArray<btTriangleMesh*> m_allocatedMeshInterfaces;
|
||||
|
||||
btHashMap<btHashPtr, UrdfCollision> m_bulletCollisionShape2UrdfCollision;
|
||||
|
||||
LinkVisualShapesConverter* m_customVisualShapesConverter;
|
||||
bool m_enableTinyRenderer;
|
||||
|
||||
@@ -569,6 +570,17 @@ bool findExistingMeshFile(
|
||||
}
|
||||
}
|
||||
|
||||
int BulletURDFImporter::getUrdfFromCollisionShape(const btCollisionShape* collisionShape, UrdfCollision& collision) const
|
||||
{
|
||||
UrdfCollision* col = m_data->m_bulletCollisionShape2UrdfCollision.find(collisionShape);
|
||||
if (col)
|
||||
{
|
||||
collision = *col;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
btCollisionShape* BulletURDFImporter::convertURDFToCollisionShape(const UrdfCollision* collision, const char* urdfPathPrefix) const
|
||||
{
|
||||
BT_PROFILE("convertURDFToCollisionShape");
|
||||
@@ -671,6 +683,7 @@ btCollisionShape* BulletURDFImporter::convertURDFToCollisionShape(const UrdfColl
|
||||
//create a convex hull for each shape, and store it in a btCompoundShape
|
||||
|
||||
shape = createConvexHullFromShapes(shapes, collision->m_geometry.m_meshScale);
|
||||
m_data->m_bulletCollisionShape2UrdfCollision.insert(shape, *collision);
|
||||
return shape;
|
||||
}
|
||||
break;
|
||||
@@ -812,6 +825,10 @@ upAxisMat.setIdentity();
|
||||
b3Warning("Error: unknown collision geometry type %i\n", collision->m_geometry.m_type);
|
||||
|
||||
}
|
||||
if (shape && collision->m_geometry.m_type==URDF_GEOM_MESH)
|
||||
{
|
||||
m_data->m_bulletCollisionShape2UrdfCollision.insert(shape, *collision);
|
||||
}
|
||||
return shape;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user