DillCreator.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef DILLCREATOR_HPP_
  2. #define DILLCREATOR_HPP_
  3. #include "MultiBodyTreeCreator.hpp"
  4. namespace btInverseDynamics
  5. {
  6. /// Creator class for building a "Dill" system as intruduced as benchmark example in
  7. /// Featherstone (1999), "A Divide-and-Conquer Articulated-Body Algorithm for Parallel O(log(n))
  8. /// Calculation of Rigid-Body Dynamics. Part 2: Trees, Loops, and Accuracy.", The International
  9. /// Journal of Robotics Research 18 (9): 876–892. doi : 10.1177 / 02783649922066628.
  10. ///
  11. /// This is a self-similar branched tree, somewhat resembling a dill plant
  12. class DillCreator : public MultiBodyTreeCreator
  13. {
  14. public:
  15. /// ctor
  16. /// @param levels the number of dill levels
  17. DillCreator(int levels);
  18. /// dtor
  19. ~DillCreator();
  20. ///\copydoc MultiBodyTreeCreator::getNumBodies
  21. int getNumBodies(int* num_bodies) const;
  22. ///\copydoc MultiBodyTreeCreator::getBody
  23. int getBody(const int body_index, int* parent_index, JointType* joint_type,
  24. vec3* parent_r_parent_body_ref, mat33* body_T_parent_ref, vec3* body_axis_of_motion,
  25. idScalar* mass, vec3* body_r_body_com, mat33* body_I_body, int* user_int,
  26. void** user_ptr) const;
  27. private:
  28. /// recursively generate dill bodies.
  29. /// TODO better documentation
  30. int recurseDill(const int levels, const int parent, const idScalar d_DH_in,
  31. const idScalar a_DH_in, const idScalar alpha_DH_in);
  32. int m_level;
  33. int m_num_bodies;
  34. idArray<int>::type m_parent;
  35. idArray<vec3>::type m_parent_r_parent_body_ref;
  36. idArray<mat33>::type m_body_T_parent_ref;
  37. idArray<vec3>::type m_body_axis_of_motion;
  38. idArray<idScalar>::type m_mass;
  39. idArray<vec3>::type m_body_r_body_com;
  40. idArray<mat33>::type m_body_I_body;
  41. int m_current_body;
  42. };
  43. } // namespace btInverseDynamics
  44. #endif