2015-06-28 21:09:21 +00:00
|
|
|
#ifndef BULLET_URDF_IMPORTER_H
|
|
|
|
#define BULLET_URDF_IMPORTER_H
|
2015-04-22 23:35:27 +00:00
|
|
|
|
|
|
|
#include "URDFImporterInterface.h"
|
|
|
|
|
2016-05-20 01:37:15 +00:00
|
|
|
#include "LinkVisualShapesConverter.h"
|
|
|
|
|
2015-04-22 23:35:27 +00:00
|
|
|
|
2016-05-10 00:25:07 +00:00
|
|
|
///BulletURDFImporter can deal with URDF and (soon) SDF files
|
2015-06-28 21:09:21 +00:00
|
|
|
class BulletURDFImporter : public URDFImporterInterface
|
2015-04-22 23:35:27 +00:00
|
|
|
{
|
|
|
|
|
2015-06-28 21:09:21 +00:00
|
|
|
struct BulletURDFInternalData* m_data;
|
2015-04-22 23:35:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2016-05-20 01:37:15 +00:00
|
|
|
BulletURDFImporter(struct GUIHelperInterface* guiHelper, LinkVisualShapesConverter* customConverter);
|
2015-04-23 22:41:17 +00:00
|
|
|
|
2015-06-28 21:09:21 +00:00
|
|
|
virtual ~BulletURDFImporter();
|
2015-04-23 22:41:17 +00:00
|
|
|
|
2015-07-07 22:39:36 +00:00
|
|
|
virtual bool loadURDF(const char* fileName, bool forceFixedBase = false);
|
2015-04-23 22:41:17 +00:00
|
|
|
|
2016-05-10 00:25:07 +00:00
|
|
|
//warning: some quick test to load SDF: we 'activate' a model, so we can re-use URDF code path
|
|
|
|
virtual bool loadSDF(const char* fileName, bool forceFixedBase = false);
|
|
|
|
virtual int getNumModels() const;
|
|
|
|
virtual void activateModel(int modelIndex);
|
2016-08-11 21:55:30 +00:00
|
|
|
virtual void setBodyUniqueId(int bodyId);
|
|
|
|
virtual int getBodyUniqueId() const;
|
2015-04-23 22:41:17 +00:00
|
|
|
const char* getPathPrefix();
|
|
|
|
|
|
|
|
void printTree(); //for debugging
|
2015-04-22 23:35:27 +00:00
|
|
|
|
2015-04-23 22:41:17 +00:00
|
|
|
virtual int getRootLinkIndex() const;
|
2015-04-22 23:35:27 +00:00
|
|
|
|
|
|
|
virtual void getLinkChildIndices(int linkIndex, btAlignedObjectArray<int>& childLinkIndices) const;
|
2017-03-23 17:16:39 +00:00
|
|
|
|
2017-03-29 22:37:33 +00:00
|
|
|
virtual std::string getBodyName() const;
|
2015-04-22 23:35:27 +00:00
|
|
|
|
|
|
|
virtual std::string getLinkName(int linkIndex) const;
|
2015-11-07 01:11:15 +00:00
|
|
|
|
|
|
|
virtual bool getLinkColor(int linkIndex, btVector4& colorRGBA) const;
|
2016-07-11 07:26:40 +00:00
|
|
|
|
|
|
|
virtual bool getLinkContactInfo(int linkIndex, URDFLinkContactInfo& contactInfo ) const;
|
2016-06-01 05:55:13 +00:00
|
|
|
|
2015-04-22 23:35:27 +00:00
|
|
|
virtual std::string getJointName(int linkIndex) const;
|
|
|
|
|
|
|
|
virtual void getMassAndInertia(int linkIndex, btScalar& mass,btVector3& localInertiaDiagonal, btTransform& inertialFrame) const;
|
|
|
|
|
2016-05-11 22:52:50 +00:00
|
|
|
virtual bool getJointInfo(int urdfLinkIndex, btTransform& parent2joint, btTransform& linkTransformInWorld, btVector3& jointAxisInJointSpace, int& jointType, btScalar& jointLowerLimit, btScalar& jointUpperLimit, btScalar& jointDamping, btScalar& jointFriction) const;
|
2017-03-26 20:06:46 +00:00
|
|
|
virtual bool getJointInfo2(int urdfLinkIndex, btTransform& parent2joint, btTransform& linkTransformInWorld, btVector3& jointAxisInJointSpace, int& jointType, btScalar& jointLowerLimit, btScalar& jointUpperLimit, btScalar& jointDamping, btScalar& jointFriction, btScalar& jointMaxForce, btScalar& jointMaxVelocity) const;
|
|
|
|
|
2016-05-11 22:52:50 +00:00
|
|
|
virtual bool getRootTransformInWorld(btTransform& rootTransformInWorld) const;
|
2015-04-22 23:35:27 +00:00
|
|
|
|
2016-06-01 05:55:13 +00:00
|
|
|
virtual int convertLinkVisualShapes(int linkIndex, const char* pathPrefix, const btTransform& inertialFrame) const;
|
|
|
|
|
2017-03-16 23:09:55 +00:00
|
|
|
virtual void convertLinkVisualShapes2(int linkIndex, int urdfIndex, const char* pathPrefix, const btTransform& inertialFrame, class btCollisionObject* colObj, int bodyUniqueId) const;
|
2015-04-22 23:35:27 +00:00
|
|
|
|
2016-04-11 23:42:02 +00:00
|
|
|
///todo(erwincoumans) refactor this convertLinkCollisionShapes/memory allocation
|
|
|
|
|
2015-04-22 23:35:27 +00:00
|
|
|
virtual class btCompoundShape* convertLinkCollisionShapes(int linkIndex, const char* pathPrefix, const btTransform& localInertiaFrame) const;
|
2016-04-11 23:42:02 +00:00
|
|
|
|
|
|
|
virtual int getNumAllocatedCollisionShapes() const;
|
|
|
|
virtual class btCollisionShape* getAllocatedCollisionShape(int index);
|
2015-04-22 23:35:27 +00:00
|
|
|
|
2016-06-01 05:55:13 +00:00
|
|
|
|
2015-04-22 23:35:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-06-28 21:09:21 +00:00
|
|
|
#endif //BULLET_URDF_IMPORTER_H
|