momentumopt
PlannerSetting.hpp
Go to the documentation of this file.
1 
9 #pragma once
10 
11 #include <unordered_map>
12 #include <yaml-cpp/yaml.h>
13 #include <solver/interface/SolverSetting.hpp>
17 
18 namespace momentumopt {
19 
20  enum class Heuristic { TrustRegion, SoftConstraint, TimeOptimization };
21 
23  {
24  public:
25  PlannerSetting() : num_dofs_(0) {}
26  ~PlannerSetting(){}
27 
28  void initialize(const std::string& cfg_file, const std::string& planner_vars_yaml = "planner_variables");
29 
30  int& get(PlannerIntParam param);
31  bool& get(PlannerBoolParam param);
32  double& get(PlannerDoubleParam param);
33  std::string& get(PlannerStringParam param);
34  Eigen::Ref<Eigen::VectorXd> get(PlannerVectorParam param);
35  std::vector<Eigen::VectorXd>& get(PlannerCVectorParam param);
36  Eigen::Ref<Eigen::VectorXi> get(PlannerIntVectorParam param);
37  std::array<Eigen::VectorXd, Problem::n_endeffs_>& get(PlannerArrayParam param);
38 
39  const int& get(PlannerIntParam param) const;
40  const bool& get(PlannerBoolParam param) const;
41  const double& get(PlannerDoubleParam param) const;
42  const std::string& get(PlannerStringParam param) const;
43  const std::vector<Eigen::VectorXd>& get(PlannerCVectorParam param) const;
44  const Eigen::Ref<const Eigen::VectorXd> get(PlannerVectorParam param) const;
45  const Eigen::Ref<const Eigen::VectorXi> get(PlannerIntVectorParam param) const;
46  const std::array<Eigen::VectorXd, Problem::n_endeffs_>& get(PlannerArrayParam param) const;
47 
48  Heuristic& heuristic() { return heuristic_; }
49  const Heuristic& heuristic() const { return heuristic_; }
50 
51  private:
53  Heuristic heuristic_;
54 
56  std::string cfg_file_, save_dynamics_file_, save_kinematics_file_, default_solver_setting_file_;
57 
59  int num_com_viapoints_, num_joint_viapoints_, num_act_eefs_, num_timesteps_, max_time_iterations_, num_dofs_,
60  num_act_dofs_, num_extended_act_dofs_, max_convergence_iters_, num_subsamples_,
61  kd_iterations_, max_trajectory_iters_;
62 
64  bool store_data_, is_time_horizon_fixed_, is_friction_cone_linear_, use_default_solver_setting_,
65  load_kinematics_, display_motion_;
66 
68  double gravity_, time_step_, robot_mass_, time_horizon_, friction_coeff_, max_time_residual_tolerance_,
69  min_time_residual_improvement_, mass_times_gravity_, w_trq_arm_, w_trq_leg_, w_time_penalty_, w_time_,
70  convergence_tolerance_, min_rel_height_, floor_height_, kin_integration_step_, kin_slacks_penalty_,
71  lambda_regularization_,swing_traj_via_z_,w_lin_mom_tracking_,w_ang_mom_tracking_,w_endeff_contact_,
72  w_endeff_tracking_,p_endeff_tracking_,p_com_tracking_,w_joint_regularization_,reg_orientation_;
73 
75  Eigen::Vector2d time_range_, torque_range_;
76  Eigen::Vector3d external_force_, com_displacement_;
77  Eigen::Vector3d w_com_, w_lmom_, w_lmomd_, w_lmom_final_, w_amom_, w_amomd_, w_amom_final_,
78  w_com_via_, w_frc_arm_, w_frc_leg_, w_dfrc_arm_, w_dfrc_leg_, gravity_vector_,
79  w_com_track_, w_lmom_track_, w_amom_track_, w_kin_base_ori_,
80  w_kin_com_, w_kin_lmom_, w_kin_amom_, w_kin_lmomd_, w_kin_amomd_, w_kin_eff_pos_,
81  w_kin_eff_pos_nonact_;
82  Eigen::VectorXd default_joint_positions_, w_kin_default_joints_, w_kin_joint_vel_, w_kin_joint_acc_,
83  min_joint_limits_, max_joint_limits_;
84  Eigen::VectorXi active_dofs_, extended_active_dofs_;
85 
87  std::vector<Eigen::VectorXd> com_viapoints_;
88 
90  std::vector<Eigen::VectorXd> joint_viapoints_;
91 
93  std::array<Eigen::VectorXd, Problem::n_endeffs_> cop_range_;
94 
96  std::array<Eigen::VectorXd, Problem::n_endeffs_> eff_offset_;
97 
99  Eigen::Matrix<double,Problem::n_endeffs_,1> max_eef_lengths_;
100  };
101 
102 }
PlannerVectorParam
Definition: PlannerParams.hpp:108
int num_com_viapoints_
Definition: PlannerSetting.hpp:59
std::array< Eigen::VectorXd, Problem::n_endeffs_ > cop_range_
Definition: PlannerSetting.hpp:93
std::vector< Eigen::VectorXd > joint_viapoints_
Definition: PlannerSetting.hpp:90
PlannerIntVectorParam
Definition: PlannerParams.hpp:100
PlannerStringParam
Definition: PlannerParams.hpp:89
Eigen::Vector2d time_range_
Definition: PlannerSetting.hpp:75
PlannerDoubleParam
Definition: PlannerParams.hpp:50
PlannerCVectorParam
Definition: PlannerParams.hpp:160
PlannerArrayParam
Definition: PlannerParams.hpp:154
std::array< Eigen::VectorXd, Problem::n_endeffs_ > eff_offset_
Definition: PlannerSetting.hpp:96
double gravity_
Definition: PlannerSetting.hpp:68
Heuristic heuristic_
Definition: PlannerSetting.hpp:53
Definition: PlannerSetting.hpp:22
Eigen::Matrix< double, Problem::n_endeffs_, 1 > max_eef_lengths_
Definition: PlannerSetting.hpp:99
std::vector< Eigen::VectorXd > com_viapoints_
Definition: PlannerSetting.hpp:87
PlannerBoolParam
Definition: PlannerParams.hpp:33
bool store_data_
Definition: PlannerSetting.hpp:64
PlannerIntParam
Definition: PlannerParams.hpp:14
std::string cfg_file_
Definition: PlannerSetting.hpp:56