momentumopt
KinematicsInterface.hpp
Go to the documentation of this file.
1 
9 #pragma once
10 
11 #include <vector>
12 #include <memory>
13 #include <Eigen/Eigen>
14 
16 //#include <solver/interface/NlpDescription.hpp>
17 //#include <momentumopt/dynopt/DynamicsState.hpp>
19 
20 namespace momentumopt {
21 
22  class KinematicsOptimizer;
23 
24  class KinematicsInterface// : public virtual solver::NlpDescription
25  {
26  public:
27  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
28 
29  public:
32 
33  // pure virtual functions to be implemented
34  virtual void initialize(PlannerSetting& planner_setting) = 0;
35  virtual Eigen::Vector3d logarithmicMap(const Eigen::Vector4d quat_wxyz) = 0;
36  virtual KinematicsState integratePosture(KinematicsState& kin_state, double dt) = 0;
37  virtual void displayPosture(const KinematicsState& kin_state, double time_step) = 0;
38  virtual KinematicsState updateJacobiansAndState(KinematicsState& kin_state, double dt) = 0;
39  virtual KinematicsState differentiatePostures(KinematicsState& start_state, KinematicsState& end_state, double timestep) = 0;
40 
41  // center of mass and momentum jacobians
42  Eigen::MatrixXd& centerOfMassJacobian() { return center_of_mass_jacobian_; }
43  Eigen::MatrixXd& centroidalMomentumMatrix() { return centroidal_momentum_matrix_; }
44  const Eigen::MatrixXd& centerOfMassJacobian() const { return center_of_mass_jacobian_; }
45  const Eigen::MatrixXd& centroidalMomentumMatrix() const { return centroidal_momentum_matrix_; }
46  void centerOfMassJacobian(const Eigen::MatrixXd& center_of_mass_jacobian) { center_of_mass_jacobian_ = center_of_mass_jacobian; }
47  void centroidalMomentumMatrix(const Eigen::MatrixXd& centroidal_mometum_matrix) { centroidal_momentum_matrix_ = centroidal_mometum_matrix; }
48 
49  Eigen::MatrixXd& centroidalMomentumMatrixVariation() { return centroidal_momentum_matrix_variation_; }
50  const Eigen::MatrixXd& centroidalMomentumMatrixVariation() const { return centroidal_momentum_matrix_variation_; }
51  void centroidalMomentumMatrixVariation(const Eigen::MatrixXd& centroidal_momentum_matrix_variation) { centroidal_momentum_matrix_variation_ = centroidal_momentum_matrix_variation; }
52 
53  // endeffector jacobians
54  Eigen::MatrixXd& endeffectorJacobian(int eff_id) { return endeffector_jacobians_[eff_id]; }
55  const std::vector<Eigen::MatrixXd>& endeffectorJacobians() const { return endeffector_jacobians_; }
56  const Eigen::MatrixXd& endeffectorJacobian(int eff_id) const { return endeffector_jacobians_[eff_id]; }
57  void endeffectorJacobians(const std::vector<Eigen::MatrixXd>& endeffector_jacobians) { endeffector_jacobians_ = endeffector_jacobians; }
58 
59  // bodies non-penetration constraints
60  const Eigen::VectorXd& constraintsVector() const { return constraints_vector_; }
61  const Eigen::MatrixXd& constraintsMatrix() const { return constraints_matrix_; }
62  void constraintsVector(const Eigen::VectorXd& constraints_vector) { constraints_vector_ = constraints_vector; }
63  void constraintsMatrix(const Eigen::MatrixXd& constraints_matrix) { constraints_matrix_ = constraints_matrix; }
64 
65  private:
66  friend class KinematicsOptimizer;
67 
69  void internalInitialization(PlannerSetting& planner_setting);
70 
73  inline const PlannerSetting& getSetting() const { return *planner_setting_; }
74 
75  private:
78 
80  Eigen::VectorXd constraints_vector_;
81  std::vector<Eigen::MatrixXd> endeffector_jacobians_;
82  Eigen::MatrixXd centroidal_momentum_matrix_, centroidal_momentum_matrix_variation_, center_of_mass_jacobian_, constraints_matrix_;
83  };
84 
85 }
Eigen::VectorXd constraints_vector_
Definition: KinematicsInterface.hpp:80
PlannerSetting & getSetting()
Definition: KinematicsInterface.hpp:72
Definition: KinematicsInterface.hpp:24
Definition: PlannerSetting.hpp:22
Definition: KinematicsOptimizer.hpp:28
void internalInitialization(PlannerSetting &planner_setting)
Definition: KinematicsInterface.cpp:14
PlannerSetting * planner_setting_
Definition: KinematicsInterface.hpp:77
This class is a container for all variables required to define a kinematics state: joint posture...
Definition: KinematicsState.hpp:146