DillCreator.hpp 1.8 KB

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