momentumopt
DynamicsFeedback.hpp
Go to the documentation of this file.
1 
9 #pragma once
10 
11 #include <solver_lqr/SolverLqr.hpp>
12 #include <solver_lqr/OcpDescription.hpp>
15 
16 namespace momentumopt {
17 
21  class DynamicsFeedback : public solverlqr::OcpBase
22  {
23  public:
26  ~DynamicsFeedback() {}
27 
29  void setPlannerSetting(const PlannerSetting& setting) { setting_ = &setting; }
30  void setStatesAndControls(const DynamicsState& ini_state, const DynamicsSequence& dyn_sequence);
31 
32  private:
34  void configure(const YAML::Node& user_parameters);
35 
37  double objective(const solverlqr::StateBase& state, const solverlqr::ControlBase& control, int time_id, bool is_final_timestep);
38 
40  solverlqr::StateBase dynamics(const solverlqr::StateBase& state, const solverlqr::ControlBase& control, int time_id);
41 
43  inline const PlannerSetting& getSetting() const { return *setting_; }
44  inline const DynamicsSequence& dynamicsSequence() const { return *ref_dyn_sequence_; }
45 
46  private:
49 
52 
54  Eigen::MatrixXd control_cost_, com_tracking_, lmom_tracking_, amom_tracking_,
55  com_final_tracking_, lmom_final_tracking_, amom_final_tracking_;
56  };
57 
58  /*
59  * Wrapper class for easily using DynamicsFeedback within Python
60  */
62  {
63  public:
66 
67  void initialize(solverlqr::SolverLqrSetting& lqr_stg, const PlannerSetting& plan_stg);
68  void optimize(const DynamicsState& ini_state, const DynamicsSequence& dynamics_sequence);
69  Eigen::MatrixXd forceGain(int time_id);
70 
71  private:
72  const PlannerSetting* plan_stg_;
73  solverlqr::SolverLqrSetting* lqr_stg_;
74 
75  DynamicsFeedback dynamics_description_;
76  solverlqr::SolverLqr dynamics_lqrsolver_;
77  };
78 }
solverlqr::StateBase dynamics(const solverlqr::StateBase &state, const solverlqr::ControlBase &control, int time_id)
Definition: DynamicsFeedback.cpp:85
const PlannerSetting & getSetting() const
Definition: DynamicsFeedback.hpp:43
Definition: DynamicsFeedback.hpp:61
Class that implements the dynamic description of momentum dynamics as an optimal control problem...
Definition: DynamicsFeedback.hpp:21
This class is a container for all variables required to define a dynamic state: center of mass positi...
Definition: DynamicsState.hpp:29
void configure(const YAML::Node &user_parameters)
Definition: DynamicsFeedback.cpp:38
DynamicsFeedback()
Definition: DynamicsFeedback.hpp:25
Definition: PlannerSetting.hpp:22
double objective(const solverlqr::StateBase &state, const solverlqr::ControlBase &control, int time_id, bool is_final_timestep)
Definition: DynamicsFeedback.cpp:56
This class is a container for a sequence of dynamic states, for all time steps in the optimization...
Definition: DynamicsState.hpp:123
const DynamicsSequence * ref_dyn_sequence_
Definition: DynamicsFeedback.hpp:51
const PlannerSetting * setting_
Definition: DynamicsFeedback.hpp:48
Eigen::MatrixXd control_cost_
Definition: DynamicsFeedback.hpp:54
void setPlannerSetting(const PlannerSetting &setting)
Definition: DynamicsFeedback.hpp:29