humoto
task_basevelocityref.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 velocity against base reference velocity
19  */
21  {
22  public:
23  explicit TaskBaseVelocityReference(const double gain = 1.0)
24  : TaskGIB("TaskBaseVelocityReference", 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 
37 
38  humoto::IndexVector &I = getIndices();
39  Eigen::VectorXd &b = getB();
40  Eigen::VectorXd &gains = getIGains();
41 
42  I.resize(loc_var.length_);
43  b.resize(loc_var.length_);
44  gains.setConstant(loc_var.length_, getGain());
45 
46  for (std::size_t i = 0; i < loc_var.length_/2; ++i)
47  {
48  I[i*2] = loc_var.offset_ + i*2;
49  I[i*2+1] = loc_var.offset_ + i*2 + 1;
50 
51  b.segment(i*2, 2) = getGain()*mpc.preview_horizon_.getBaseReferenceVelocity(i);
52  }
53  };
54  };
55  } //pepper
56 } //humoto
Abstract base class (for control problems)
void form(const humoto::SolutionStructure &sol_structure, const humoto::Model &model_base, const humoto::ControlProblem &control_problem)
Form the task.
#define HUMOTO_LOCAL
Definition: export_import.h:26
static const char * BASE_VEL_VARIABLES_ID
Definition: common.h:17
Analog of &#39;sol_structure&#39; struct in Octave code. [determine_solution_structure.m].
Definition: solution.h:33
Task for minimizing base velocity against base reference velocity.
Eigen::Matrix< unsigned int, Eigen::Dynamic, 1 > IndexVector
Definition: utility.h:19
Location getSolutionPartLocation(const std::string &id) const
Get location of a data in the solution vector.
Definition: solution.h:122
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
etools::Vector2 getBaseReferenceVelocity(const std::size_t interval_index) const
Get base reference velocity.
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
Location of a data chunk (offset + length).
Definition: utility.h:146
Task: diag(G)*x[I] = b.
Definition: task.h:566
humoto::pepper_mpc::PreviewHorizon preview_horizon_
Definition: mpc_mg.h:334