25 const std::array<double, 7>& dq,
26 const std::array<double, 9>& i_total,
28 const std::array<double, 3>& f_x_ctotal,
29 std::array<double, 7>& c_ne)
override;
32 const std::array<double, 7>& dq,
33 const std::array<double, 9>& i_total,
35 const std::array<double, 3>& f_x_ctotal,
36 const std::array<double, 3>& g_earth,
37 std::array<double, 7>& c_ne)
override;
39 void gravity(
const std::array<double, 7>& q,
40 const std::array<double, 3>& g_earth,
42 const std::array<double, 3>& f_x_ctotal,
43 std::array<double, 7>& g_ne)
override;
45 void mass(
const std::array<double, 7>& q,
46 const std::array<double, 9>& i_total,
48 const std::array<double, 3>& f_x_ctotal,
49 std::array<double, 49>& m_ne)
override;
52 mutable pinocchio::Data data_;
53 mutable pinocchio::Data data_gravity_;
55 mutable Eigen::Matrix<double, 7, 1> q_eigen_;
56 mutable Eigen::Matrix<double, 7, 1> dq_eigen_;
57 mutable Eigen::Matrix<double, 7, 1> tau_eigen_;
58 mutable Eigen::Matrix<double, 7, 1> ddq_temp_eigen_;
59 mutable Eigen::Vector3d com_eigen_;
60 mutable Eigen::Matrix3d inertia_eigen_;
62 mutable std::array<double, 9> cached_i_total_;
63 mutable double cached_m_total_;
64 mutable std::array<double, 3> cached_f_x_ctotal_;
65 mutable bool inertia_cache_valid_;
67 mutable pinocchio::Model pinocchio_model_;
68 pinocchio::Inertia initial_last_link_inertia_;
69 pinocchio::FrameIndex last_link_frame_index_;
70 pinocchio::JointIndex last_joint_index_;
72 void updateInertiaIfNeeded(
const std::array<double, 9>& i_total,
74 const std::array<double, 3>& f_x_ctotal)
const;
76 void restoreOriginalInertia()
const;
78 void computeGravityVector(
const std::array<double, 7>& q,
79 const std::array<double, 3>& g_earth,
80 std::array<double, 7>& g_ne)
const;
82 void copyToEigenQ(
const std::array<double, 7>& q)
const;
83 void copyToEigenDQ(
const std::array<double, 7>& dq)
const;
84 void copyFromEigen(
const Eigen::VectorXd& src, std::array<double, 7>& dst)
const;
85 void copyFromEigenMatrix(
const Eigen::MatrixXd& src, std::array<double, 49>& dst)
const;
void gravity(const std::array< double, 7 > &q, const std::array< double, 3 > &g_earth, double m_total, const std::array< double, 3 > &f_x_ctotal, std::array< double, 7 > &g_ne) override
Calculates the gravity vector.
void mass(const std::array< double, 7 > &q, const std::array< double, 9 > &i_total, double m_total, const std::array< double, 3 > &f_x_ctotal, std::array< double, 49 > &m_ne) override
Calculates the 7x7 inertia matrix.
void coriolis(const std::array< double, 7 > &q, const std::array< double, 7 > &dq, const std::array< double, 9 > &i_total, double m_total, const std::array< double, 3 > &f_x_ctotal, std::array< double, 7 > &c_ne) override
Calculates the Coriolis force vector (state-space equation): , in .
void coriolis(const std::array< double, 7 > &q, const std::array< double, 7 > &dq, const std::array< double, 9 > &i_total, double m_total, const std::array< double, 3 > &f_x_ctotal, const std::array< double, 3 > &g_earth, std::array< double, 7 > &c_ne) override
Calculates the Coriolis force vector with configurable gravity (recommended implementation).