centroidal_control_collection
LinearMpcZ.h
Go to the documentation of this file.
1 /* Author: Masaki Murooka */
2 
3 #pragma once
4 
5 #include <functional>
6 
7 #include <qp_solver_collection/QpSolverCollection.h>
8 
10 
11 namespace CCC
12 {
15 {
16 public:
18  static constexpr int state_dim_ = 2;
19 
22 
25 
26 public:
31  using InitialParam = Eigen::Vector2d;
32 
34  struct WeightParam
35  {
37  double pos;
38 
40  double force;
41 
46  WeightParam(double _pos = 1.0, double _force = 1e-7) : pos(_pos), force(_force) {}
47  };
48 
76  {
77  public:
81  ModelContactPhase(double mass);
82  };
83 
109  {
110  public:
114  ModelNoncontactPhase(double mass);
115  };
116 
117 public:
118  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
119 
127  LinearMpcZ(double mass,
128  double horizon_dt,
129  int horizon_steps,
130  const WeightParam & weight_param = WeightParam(),
131  QpSolverCollection::QpSolverType qp_solver_type = QpSolverCollection::QpSolverType::Any);
132 
140  double planOnce(const std::function<bool(double)> & contact_func,
141  const std::function<double(double)> & ref_pos_func,
142  const InitialParam & initial_param,
143  double current_time);
144 
145 protected:
147  double procOnce(const std::vector<std::shared_ptr<_StateSpaceModel>> & model_list,
148  const StateDimVector & current_x,
149  const Eigen::VectorXd & ref_pos_seq);
150 
151 public:
153  double mass_ = 0;
154 
156  double horizon_dt_ = 0;
157 
159  int horizon_steps_ = 0;
160 
163 
165  std::shared_ptr<_StateSpaceModel> model_contact_;
166 
168  std::shared_ptr<_StateSpaceModel> model_noncontact_;
169 
171  std::shared_ptr<QpSolverCollection::QpSolver> qp_solver_;
172 
174  QpSolverCollection::QpCoeff qp_coeff_;
175 
177  std::pair<double, double> force_range_;
178 };
179 } // namespace CCC
VariantSequentialExtension.h
CCC::LinearMpcZ::InitialParam
Eigen::Vector2d InitialParam
Initial parameter.
Definition: LinearMpcZ.h:31
CCC::LinearMpcZ::planOnce
double planOnce(const std::function< bool(double)> &contact_func, const std::function< double(double)> &ref_pos_func, const InitialParam &initial_param, double current_time)
Plan one step.
CCC::LinearMpcZ::horizon_steps_
int horizon_steps_
Number of steps in horizon.
Definition: LinearMpcZ.h:159
CCC::LinearMpcZ::horizon_dt_
double horizon_dt_
Discretization timestep in horizon [sec].
Definition: LinearMpcZ.h:156
CCC::LinearMpcZ::WeightParam::WeightParam
WeightParam(double _pos=1.0, double _force=1e-7)
Constructor.
Definition: LinearMpcZ.h:46
CCC::LinearMpcZ::mass_
double mass_
Robot mass [kg].
Definition: LinearMpcZ.h:153
CCC::LinearMpcZ::model_noncontact_
std::shared_ptr< _StateSpaceModel > model_noncontact_
State-space model for non-contact phase.
Definition: LinearMpcZ.h:168
CCC::LinearMpcZ::qp_solver_
std::shared_ptr< QpSolverCollection::QpSolver > qp_solver_
QP solver.
Definition: LinearMpcZ.h:171
CCC::LinearMpcZ::StateDimVector
_StateSpaceModel::StateDimVector StateDimVector
Type of state vector.
Definition: LinearMpcZ.h:24
CCC::LinearMpcZ::qp_coeff_
QpSolverCollection::QpCoeff qp_coeff_
QP coefficients.
Definition: LinearMpcZ.h:174
CCC::LinearMpcZ::WeightParam::force
double force
Force weight.
Definition: LinearMpcZ.h:40
CCC::LinearMpcZ::procOnce
double procOnce(const std::vector< std::shared_ptr< _StateSpaceModel >> &model_list, const StateDimVector &current_x, const Eigen::VectorXd &ref_pos_seq)
Process one step.
CCC::StateSpaceModel::StateDimVector
Eigen::Matrix< double, StateDim, 1 > StateDimVector
Type of state vector.
Definition: StateSpaceModel.h:25
CCC::StateSpaceModel
State-space model.
Definition: StateSpaceModel.h:21
CCC::LinearMpcZ::ModelNoncontactPhase
State-space model for non-contact phase.
Definition: LinearMpcZ.h:108
CCC::LinearMpcZ::WeightParam
Weight parameter.
Definition: LinearMpcZ.h:34
CCC
Definition: CommonModels.h:7
CCC::LinearMpcZ
Linear MPC of translational z-component motion.
Definition: LinearMpcZ.h:14
CCC::LinearMpcZ::state_dim_
static constexpr int state_dim_
State dimension.
Definition: LinearMpcZ.h:18
CCC::LinearMpcZ::LinearMpcZ
EIGEN_MAKE_ALIGNED_OPERATOR_NEW LinearMpcZ(double mass, double horizon_dt, int horizon_steps, const WeightParam &weight_param=WeightParam(), QpSolverCollection::QpSolverType qp_solver_type=QpSolverCollection::QpSolverType::Any)
Constructor.
CCC::LinearMpcZ::ModelContactPhase
State-space model for contact phase.
Definition: LinearMpcZ.h:75
CCC::LinearMpcZ::WeightParam::pos
double pos
Position weight.
Definition: LinearMpcZ.h:37
CCC::LinearMpcZ::force_range_
std::pair< double, double > force_range_
Min/max z-component force [N].
Definition: LinearMpcZ.h:177
CCC::LinearMpcZ::model_contact_
std::shared_ptr< _StateSpaceModel > model_contact_
State-space model for contact phase.
Definition: LinearMpcZ.h:165
CCC::LinearMpcZ::ModelContactPhase::ModelContactPhase
ModelContactPhase(double mass)
Constructor.
CCC::LinearMpcZ::ModelNoncontactPhase::ModelNoncontactPhase
ModelNoncontactPhase(double mass)
Constructor.
CCC::LinearMpcZ::weight_param_
WeightParam weight_param_
Objective weight parameter.
Definition: LinearMpcZ.h:162