humoto
task_basepositionref.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Jan Michalczyk
4  @author Alexander Sherikov
5  @copyright 2014-2017 INRIA. Licensed under the Apache License, Version 2.0.
6  (see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
7 
8  @brief
9 */
10 
11 #pragma once
12 
13 namespace humoto
14 {
15  namespace pepper_mpc
16  {
17  /**
18  * @brief Task for minimizing base position against base reference position
19  */
21  {
22  public:
23  explicit TaskBasePositionReference(const double gain = 0.707106781186548)
24  : TaskASB("TaskBasePositionReference", gain)
25  {
26  }
27 
28 
29  /// @copydoc humoto::TaskBase::form
30  void form( const humoto::SolutionStructure &sol_structure,
31  const humoto::Model &model_base,
32  const humoto::ControlProblem &control_problem)
33  {
34  const humoto::pepper_mpc::MPCforMG &mpc = dynamic_cast <const humoto::pepper_mpc::MPCforMG &> (control_problem);
35 
36  Eigen::MatrixXd &A = getA();
37  Eigen::VectorXd &b = getB();
38 
39  setOffset(0);
40  A.noalias() = getGain()*mpc.Aps_;
41 
42  b.resize(A.rows());
43 
44  for (EigenIndex i = 0; i < b.rows()/2; ++i)
45  {
46  b.segment(i*2, 2) = mpc.preview_horizon_.getBaseReferencePosition(i);
47  }
48 
49  b -= mpc.sps_;
50  b *= getGain();
51  }
52  };
53  } //pepper
54 } //humoto
void form(const humoto::SolutionStructure &sol_structure, const humoto::Model &model_base, const humoto::ControlProblem &control_problem)
Form the task.
Abstract base class (for control problems)
Task for minimizing base position against base reference position.
#define HUMOTO_LOCAL
Definition: export_import.h:26
Analog of &#39;sol_structure&#39; struct in Octave code. [determine_solution_structure.m].
Definition: solution.h:33
EIGEN_DEFAULT_DENSE_INDEX_TYPE EigenIndex
Definition: utility.h:26
Task: A*S*x = b.
Definition: task.h:554
The root namespace of HuMoTo.
Definition: config.h:12
Instances of this class are passed to a virtual method &#39;humoto::TaskBase::form()&#39;, so even though this class is basically useless in its present form we cannot avoid its definition using a template.
Definition: model.h:41
TaskBasePositionReference(const double gain=0.707106781186548)
Model Predictive Control problem for walking pattern generation [determine_solution_structure.m, form_rotation_matrices.m, form_foot_pos_matrices.m, form_condensing_matrices.m].
Definition: mpc_mg.h:20
etools::Vector2 getBaseReferencePosition(const std::size_t interval_index) const
Get base reference position.
Eigen::VectorXd sps_
Definition: mpc_mg.h:352
Eigen::MatrixXd Aps_
Definition: mpc_mg.h:353
humoto::pepper_mpc::PreviewHorizon preview_horizon_
Definition: mpc_mg.h:334