humoto
task_comvelocity.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4  @author Jan Michalczyk
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 wpg04
16  {
17  /**
18  * @brief [task_cvel.m]
19  */
21  {
22  #define HUMOTO_CONFIG_ENTRIES \
23  HUMOTO_CONFIG_PARENT_CLASS(TaskAB)
24  #include HUMOTO_CONFIG_DEFINE_ACCESSORS
25 
26 
27  protected:
28  void setDefaults()
29  {
31  setGain(0.707106781186548);
32  }
33 
34 
35  void finalize()
36  {
38  }
39 
40 
41  public:
42  explicit TaskCoMVelocity(const double gain = 0.707106781186548) : TaskAB("TaskCoMVelocity", gain)
43  {
44  }
45 
46 
47  /// @copydoc humoto::TaskBase::form
48  void form( const humoto::SolutionStructure &sol_structure,
49  const humoto::Model &model_base,
50  const humoto::ControlProblem &control_problem)
51  {
52  const humoto::wpg04::MPCforWPG &mpc = dynamic_cast <const humoto::wpg04::MPCforWPG &> (control_problem);
53 
54 
55  Eigen::MatrixXd &A = getA();
56  Eigen::VectorXd &b = getB();
57 
58  Eigen::VectorXd cvel_ref;
59  cvel_ref.resize(mpc.getPreviewHorizonLength()*2);
60 
61  for (std::size_t i = 0; i < mpc.getPreviewHorizonLength(); ++i)
62  {
63  cvel_ref.segment(i*2, 2) = mpc.preview_horizon_.intervals_[i].cvel_ref_;
64  }
65 
66  A.noalias() = getGain() * (mpc.velocity_selector_ * mpc.S_); // Sv
67 
68  b.noalias() = -getGain() * (mpc.velocity_selector_ * mpc.s_ /*sv*/ - cvel_ref);
69  };
70  };
71  }
72 }
Abstract base class (for control problems)
void setDefaults()
Set members to their default values.
#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
virtual void setDefaults()
Set members to their default values.
Definition: task.h:332
std::vector< PreviewHorizonInterval > intervals_
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_wpg.h:21
The root namespace of HuMoTo.
Definition: config.h:12
etools::SelectionMatrix velocity_selector_
Definition: mpc_wpg.h:245
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
void finalize()
This function is called automaticaly after reading a configuration file. Does nothing by default...
std::size_t getPreviewHorizonLength() const
Returns length of the preview horizon.
Definition: mpc_wpg.h:613
TaskCoMVelocity(const double gain=0.707106781186548)
void finalize()
This function is called automaticaly after reading a configuration file. Does nothing by default...
Definition: task.h:337
void form(const humoto::SolutionStructure &sol_structure, const humoto::Model &model_base, const humoto::ControlProblem &control_problem)
Form the task.
Task: A*x = b.
Definition: task.h:542
Eigen::MatrixXd s_
Definition: mpc_wpg.h:243
humoto::wpg04::PreviewHorizon preview_horizon_
Definition: mpc_wpg.h:230
Eigen::MatrixXd S_
Definition: mpc_wpg.h:242