00001 00025 /* 00026 * This file is part of ocra-recipes. 00027 * Copyright (C) 2016 Institut des Systèmes Intelligents et de Robotique (ISIR) 00028 * 00029 * This program is free software: you can redistribute it and/or modify 00030 * it under the terms of the GNU General Public License as published by 00031 * the Free Software Foundation, either version 3 of the License, or 00032 * (at your option) any later version. 00033 * 00034 * This program is distributed in the hope that it will be useful, 00035 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00036 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00037 * GNU General Public License for more details. 00038 * 00039 * You should have received a copy of the GNU General Public License 00040 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00041 */ 00042 00043 #ifndef _MIQP_LINEAR_CONSTRAINTS_H_ 00044 #define _MIQP_LINEAR_CONSTRAINTS_H_ 00045 00046 #include "walking-client/constraints/ShapeConstraints.h" 00047 #include "walking-client/constraints/AdmissibilityConstraints.h" 00048 #include "walking-client/StepController.h" 00049 #include "walking-client/BaseOfSupport.h" 00050 #include "walking-client/utils.h" 00051 00052 class MIQPLinearConstraints { 00053 private: 00054 std::shared_ptr<ShapeConstraints> _shapeCnstr; 00055 std::shared_ptr<AdmissibilityConstraints> _admissibilityCnstr; 00056 std::shared_ptr<StepController> _stepController; 00057 Eigen::MatrixXd _AShapeAdmiss; 00058 Eigen::MatrixXd _BShapeAdmiss; 00059 Eigen::VectorXd _fcbarShapeAdmiss; 00060 Eigen::MatrixXd _A; 00061 // f_c - B*Xi_k 00062 Eigen::VectorXd _rhs; 00063 Eigen::MatrixXd _Acr; 00064 Eigen::MatrixXd _Acl; 00065 00079 Eigen::MatrixXd _Q; 00080 00097 Eigen::MatrixXd _T; 00098 00109 Eigen::MatrixXd _Bh; 00110 00127 Eigen::MatrixXd _Ah; 00128 00132 bool _addShapeCtrs; 00133 00137 bool _addAdmissibilityCtrs; 00138 00142 bool _addCoPConstraints; 00143 00147 bool _addWalkingCtrs; 00148 00150 unsigned int _dt; 00151 00153 unsigned int _N; 00154 00156 unsigned int _nConstraints; 00157 00159 std::shared_ptr<BaseOfSupport> _baseOfSupport; 00160 00161 MIQPParameters _miqpParams; 00162 public: 00163 00170 MIQPLinearConstraints(std::shared_ptr<StepController> stepController, MIQPParameters &miqpParams); 00171 00175 virtual ~MIQPLinearConstraints (); 00176 00182 void updateRHS(const Eigen::VectorXd& xi_k); 00183 00191 void getConstraintsMatrixA(Eigen::MatrixXd &A); 00192 00198 unsigned int getTotalNumberOfConstraints(); 00199 00206 void getRHS(Eigen::VectorXd &rhs); 00207 00208 protected: 00229 void buildShapeAndAdmissibilityInPreviewWindow(); 00235 void buildAShapeAdmiss(); 00241 void buildBShapeAdmiss(); 00245 void buildFcBarShapeAdmiss(); 00249 void setMatrixAcr(); 00253 void setMatrixAcl(); 00263 void buildMatrixQ(); 00273 void buildMatrixT(); 00279 void buildBh(); 00285 void buildAh(); 00286 }; 00287 #endif