MultiBodyTreeCreator.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef MULTI_BODY_TREE_CREATOR_HPP_
  2. #define MULTI_BODY_TREE_CREATOR_HPP_
  3. #include <string>
  4. #include <vector>
  5. #include "BulletInverseDynamics/IDConfig.hpp"
  6. #include "BulletInverseDynamics/IDMath.hpp"
  7. #include "BulletInverseDynamics/MultiBodyTree.hpp"
  8. #include "MultiBodyNameMap.hpp"
  9. namespace btInverseDynamics
  10. {
  11. /// Interface class for initializing a MultiBodyTree instance.
  12. /// Data to be provided is modeled on the URDF specification.
  13. /// The user can derive from this class in order to programmatically
  14. /// initialize a system.
  15. class MultiBodyTreeCreator
  16. {
  17. public:
  18. /// the dtor
  19. virtual ~MultiBodyTreeCreator() {}
  20. /// Get the number of bodies in the system
  21. /// @param num_bodies write number of bodies here
  22. /// @return 0 on success, -1 on error
  23. virtual int getNumBodies(int* num_bodies) const = 0;
  24. /// Interface for accessing link mass properties.
  25. /// For detailed description of data, @sa MultiBodyTree::addBody
  26. /// \copydoc MultiBodyTree::addBody
  27. virtual int getBody(const int body_index, int* parent_index, JointType* joint_type,
  28. vec3* parent_r_parent_body_ref, mat33* body_T_parent_ref,
  29. vec3* body_axis_of_motion, idScalar* mass, vec3* body_r_body_com,
  30. mat33* body_I_body, int* user_int, void** user_ptr) const = 0;
  31. /// @return a pointer to a name mapping utility class, or 0x0 if not available
  32. virtual const MultiBodyNameMap* getNameMap() const { return 0x0; }
  33. };
  34. /// Create a multibody object.
  35. /// @param creator an object implementing the MultiBodyTreeCreator interface
  36. /// that returns data defining the system
  37. /// @return A pointer to an allocated multibodytree instance, or
  38. /// 0x0 if an error occured.
  39. MultiBodyTree* CreateMultiBodyTree(const MultiBodyTreeCreator& creator);
  40. } // namespace btInverseDynamics
  41. // does urdf have gravity direction ??
  42. #endif // MULTI_BODY_TREE_CREATOR_HPP_