Add body name when loading urdf.
This commit is contained in:
@@ -1311,6 +1311,11 @@ int BulletMJCFImporter::getRootLinkIndex() const
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string BulletMJCFImporter::getBodyName() const
|
||||||
|
{
|
||||||
|
return m_data->m_fileModelName;
|
||||||
|
}
|
||||||
|
|
||||||
bool BulletMJCFImporter::getLinkColor(int linkIndex, btVector4& colorRGBA) const
|
bool BulletMJCFImporter::getLinkColor(int linkIndex, btVector4& colorRGBA) const
|
||||||
{
|
{
|
||||||
// UrdfLink* link = m_data->getLink(linkIndex);
|
// UrdfLink* link = m_data->getLink(linkIndex);
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ public:
|
|||||||
|
|
||||||
///pure virtual interfaces, precondition is a valid linkIndex (you can assert/terminate if the linkIndex is out of range)
|
///pure virtual interfaces, precondition is a valid linkIndex (you can assert/terminate if the linkIndex is out of range)
|
||||||
virtual std::string getLinkName(int linkIndex) const;
|
virtual std::string getLinkName(int linkIndex) const;
|
||||||
|
|
||||||
|
virtual std::string getBodyName() const;
|
||||||
|
|
||||||
/// optional method to provide the link color. return true if the color is available and copied into colorRGBA, return false otherwise
|
/// optional method to provide the link color. return true if the color is available and copied into colorRGBA, return false otherwise
|
||||||
virtual bool getLinkColor(int linkIndex, btVector4& colorRGBA) const;
|
virtual bool getLinkColor(int linkIndex, btVector4& colorRGBA) const;
|
||||||
|
|||||||
@@ -269,6 +269,11 @@ std::string BulletURDFImporter::getLinkName(int linkIndex) const
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string BulletURDFImporter::getBodyName() const
|
||||||
|
{
|
||||||
|
return m_data->m_urdfParser.getModel().m_name;
|
||||||
|
}
|
||||||
|
|
||||||
std::string BulletURDFImporter::getJointName(int linkIndex) const
|
std::string BulletURDFImporter::getJointName(int linkIndex) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ public:
|
|||||||
virtual int getRootLinkIndex() const;
|
virtual int getRootLinkIndex() const;
|
||||||
|
|
||||||
virtual void getLinkChildIndices(int linkIndex, btAlignedObjectArray<int>& childLinkIndices) const;
|
virtual void getLinkChildIndices(int linkIndex, btAlignedObjectArray<int>& childLinkIndices) const;
|
||||||
|
|
||||||
|
virtual std::string getBodyName() const;
|
||||||
|
|
||||||
virtual std::string getLinkName(int linkIndex) const;
|
virtual std::string getLinkName(int linkIndex) const;
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ public:
|
|||||||
|
|
||||||
///pure virtual interfaces, precondition is a valid linkIndex (you can assert/terminate if the linkIndex is out of range)
|
///pure virtual interfaces, precondition is a valid linkIndex (you can assert/terminate if the linkIndex is out of range)
|
||||||
virtual std::string getLinkName(int linkIndex) const =0;
|
virtual std::string getLinkName(int linkIndex) const =0;
|
||||||
|
|
||||||
|
virtual std::string getBodyName() const = 0;
|
||||||
|
|
||||||
/// optional method to provide the link color. return true if the color is available and copied into colorRGBA, return false otherwise
|
/// optional method to provide the link color. return true if the color is available and copied into colorRGBA, return false otherwise
|
||||||
virtual bool getLinkColor(int linkIndex, btVector4& colorRGBA) const { return false;}
|
virtual bool getLinkColor(int linkIndex, btVector4& colorRGBA) const { return false;}
|
||||||
|
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ struct InteralBodyData
|
|||||||
btMultiBody* m_multiBody;
|
btMultiBody* m_multiBody;
|
||||||
btRigidBody* m_rigidBody;
|
btRigidBody* m_rigidBody;
|
||||||
int m_testData;
|
int m_testData;
|
||||||
|
std::string m_bodyName;
|
||||||
|
|
||||||
btTransform m_rootLocalInertialFrame;
|
btTransform m_rootLocalInertialFrame;
|
||||||
btAlignedObjectArray<btTransform> m_linkLocalInertialFrames;
|
btAlignedObjectArray<btTransform> m_linkLocalInertialFrames;
|
||||||
@@ -1607,6 +1608,8 @@ bool PhysicsServerCommandProcessor::loadUrdf(const char* fileName, const btVecto
|
|||||||
|
|
||||||
btMultiBody* mb = creation.getBulletMultiBody();
|
btMultiBody* mb = creation.getBulletMultiBody();
|
||||||
btRigidBody* rb = creation.getRigidBody();
|
btRigidBody* rb = creation.getRigidBody();
|
||||||
|
|
||||||
|
bodyHandle->m_bodyName = u2b.getBodyName();
|
||||||
|
|
||||||
if (useMultiBody)
|
if (useMultiBody)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ protected:
|
|||||||
bool loadSdf(const char* fileName, char* bufferServerToClient, int bufferSizeInBytes, bool useMultiBody, int flags);
|
bool loadSdf(const char* fileName, char* bufferServerToClient, int bufferSizeInBytes, bool useMultiBody, int flags);
|
||||||
|
|
||||||
bool loadUrdf(const char* fileName, const class btVector3& pos, const class btQuaternion& orn,
|
bool loadUrdf(const char* fileName, const class btVector3& pos, const class btQuaternion& orn,
|
||||||
bool useMultiBody, bool useFixedBase, int* bodyUniqueIdPtr, char* bufferServerToClient, int bufferSizeInBytes);
|
bool useMultiBody, bool useFixedBase, int* bodyUniqueIdPtr, char* bufferServerToClient, int bufferSizeInBytes);
|
||||||
|
|
||||||
bool loadMjcf(const char* fileName, char* bufferServerToClient, int bufferSizeInBytes, bool useMultiBody, int flags);
|
bool loadMjcf(const char* fileName, char* bufferServerToClient, int bufferSizeInBytes, bool useMultiBody, int flags);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user