prepare for 'custom' multi body creation.

This commit is contained in:
erwin coumans
2015-04-22 18:09:00 -07:00
parent b64f5feba4
commit 51938d642e
7 changed files with 118 additions and 60 deletions

View File

@@ -172,61 +172,6 @@ void printTree1(my_shared_ptr<const Link> link,int level = 0)
}
struct URDF_LinkInformation
{
const Link* m_thisLink;
int m_linkIndex;
//int m_parentIndex;
btTransform m_localInertialFrame;
//btTransform m_localVisualFrame;
btTransform m_bodyWorldTransform;
btVector3 m_localInertiaDiagonal;
btScalar m_mass;
btCollisionShape* m_collisionShape;
btRigidBody* m_bulletRigidBody;
URDF_LinkInformation()
:m_thisLink(0),
m_linkIndex(-2),
//m_parentIndex(-2),
m_collisionShape(0),
m_bulletRigidBody(0)
{
}
virtual ~URDF_LinkInformation()
{
printf("~\n");
}
};
struct URDF_JointInformation
{
};
struct URDF2BulletMappings
{
btHashMap<btHashPtr /*to Link*/, URDF_LinkInformation*> m_link2rigidbody;
btAlignedObjectArray<btScalar> m_linkMasses;
bool m_createMultiBody;
int m_totalNumJoints;
btMultiBody* m_bulletMultiBody;
btAlignedObjectArray<int> m_urdfLinkIndices2BulletLinkIndices;
URDF2BulletMappings()
:m_createMultiBody(false),
m_totalNumJoints(0),
m_bulletMultiBody(0)
{
}
};
void ImportUrdfSetup::initPhysics()
@@ -257,7 +202,6 @@ void ImportUrdfSetup::initPhysics()
bool fileFound = fu.findFile(m_fileName, relativeFileName, 1024);
std::string xml_string;
char pathPrefix[1024];
pathPrefix[0] = 0;
@@ -316,7 +260,7 @@ void ImportUrdfSetup::initPhysics()
bool useUrdfInterfaceClass = true;
{
URDF2BulletMappings mappings;
btMultiBody* mb = 0;

View File

@@ -40,8 +40,8 @@ class btMultiBodyLinkCollider* MyMultiBodyCreator::allocateMultiBodyLinkCollider
btMultiBodyLinkCollider* mbCol= new btMultiBodyLinkCollider(multiBody, mbLinkIndex);
return mbCol;
}
class btGeneric6DofSpring2Constraint* MyMultiBodyCreator::allocateGeneric6DofSpring2Constraint(int urdfLinkIndex, btRigidBody& rbA /*parent*/, btRigidBody& rbB, const btTransform& offsetInA, const btTransform& offsetInB, int rotateOrder)
{
btGeneric6DofSpring2Constraint* c = new btGeneric6DofSpring2Constraint(rbA,rbB,offsetInA, offsetInB, (RotateOrder)rotateOrder);

View File

@@ -5,7 +5,7 @@
#include "MultiBodyCreationInterface.h"
#include "LinearMath/btAlignedObjectArray.h"
class GUIHelperInterface;
struct GUIHelperInterface;
class btMultiBody;
class MyMultiBodyCreator : public MultiBodyCreationInterface