hpp-constraints: include/hpp/constraints/qp-static-stability.hh Source File

hpp-constraints 9.0.2 Definition of basic geometric constraints for motion planning

Loading...
Searching...
No Matches
qp-static-stability.hh
Go to the documentation of this file.
1// Copyright (c) 2015, LAAS-CNRS
2// Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3//
4
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions are
7// met:
8//
9// 1. Redistributions of source code must retain the above copyright
10// notice, this list of conditions and the following disclaimer.
11//
12// 2. Redistributions in binary form must reproduce the above copyright
13// notice, this list of conditions and the following disclaimer in the
14// documentation and/or other materials provided with the distribution.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27// DAMAGE.
28
29#ifndef HPP_CONSTRAINTS_QP_STATIC_STABILITY_HH
30#define HPP_CONSTRAINTS_QP_STATIC_STABILITY_HH
31
32#include <hpp/constraints/convex-shape-contact.hh>
33#include <hpp/constraints/differentiable-function.hh>
34#include <hpp/constraints/fwd.hh>
35#include <hpp/constraints/static-stability.hh>
36#include <qpOASES.hpp>
37
38 namespace hpp {
39 namespace constraints {
40
44
50// counter-balance the gravity force and momentum of a kinematics chain.
54 class HPP_CONSTRAINTS_DLLAPI QPStaticStability : public DifferentiableFunction {
55 public:
56 static const Eigen::Matrix<value_type, 6, 1> Gravity;
57
58 typedef StaticStability::Contact_t Contact_t;
59 typedef StaticStability::Contacts_t Contacts_t;
60 typedef ConvexShapeContact::ForceData ForceData;
61
67 QPStaticStability(const std::string& name, const DevicePtr_t& robot,
68 const Contacts_t& contacts,
69 const CenterOfMassComputationPtr_t& com);
70
74 QPStaticStability(const std::string& name, const DevicePtr_t& robot,
75 const std::vector<ForceData>& contacts,
76 const CenterOfMassComputationPtr_t& com);
77
78 static QPStaticStabilityPtr_t create(const std::string& name,
79 const DevicePtr_t& robot,
80 const Contacts_t& contacts,
81 const CenterOfMassComputationPtr_t& com);
82
83 static QPStaticStabilityPtr_t create(const std::string& name,
84 const DevicePtr_t& robot,
85 const std::vector<ForceData>& contacts,
86 const CenterOfMassComputationPtr_t& com);
87
88 static QPStaticStabilityPtr_t create(const DevicePtr_t& robot,
89 const Contacts_t& contacts,
90 const CenterOfMassComputationPtr_t& com);
91
92 MatrixOfExpressions<>& phi() { return phi_; }
93
94 protected:
95 bool isEqual(const DifferentiableFunction& other) const {
96 const QPStaticStability& castother =
97 dynamic_cast<const QPStaticStability&>(other);
98 if (!DifferentiableFunction::isEqual(other)) return false;
99
100 if (name() != castother.name()) return false;
101 if (robot_ != castother.robot_) return false;
102 if (nbContacts_ != castother.nbContacts_) return false;
103 if (com_ != castother.com_) return false;
104 if (Zeros != castother.Zeros) return false;
105 if (nWSR != castother.nWSR) return false;
106
107 return true;
108 }
109
110 private:
111 static const Eigen::Matrix<value_type, 6, 1> MinusGravity;
112
113 qpOASES::real_t* Zeros;
114 const qpOASES::int_t nWSR;
115
116 void impl_compute(LiegroupElementRef result,
117 ConfigurationIn_t argument) const;
118
119 void impl_jacobian(matrixOut_t jacobian, ConfigurationIn_t argument) const;
120
121 qpOASES::returnValue solveQP(vectorOut_t result) const;
122
123 bool checkQPSol() const;
124 bool checkStrictComplementarity() const;
125
126 DevicePtr_t robot_;
127 std::size_t nbContacts_;
128 CenterOfMassComputationPtr_t com_;
129
130 typedef MatrixOfExpressions<eigen::vector3_t, JacobianMatrix> MoE_t;
131 typedef Eigen::Matrix<qpOASES::real_t, Eigen::Dynamic, Eigen::Dynamic,
132 Eigen::RowMajor>
133 RowMajorMatrix_t;
134 typedef Eigen::Map<RowMajorMatrix_t> InvertStorageOrderMap_t;
135 typedef Eigen::Map<Eigen::Matrix<qpOASES::real_t, Eigen::Dynamic, 1> >
136 VectorMap_t;
137 typedef Eigen::Map<const vector_t> ConstVectorMap_t;
138
139 mutable RowMajorMatrix_t H_;
140 mutable vector_t G_;
141 mutable qpOASES::QProblemB qp_;
142 mutable MoE_t phi_;
143 mutable vector_t primal_, dual_;
144};
146} // namespace constraints
147} // namespace hpp
148
149#endif // HPP_CONSTRAINTS_STATIC_STABILITY_HH
hpp::constraints::DifferentiableFunction
Definition differentiable-function.hh:63
hpp::constraints::DifferentiableFunction::name
const std::string & name() const
Get function name.
Definition differentiable-function.hh:122
hpp::constraints::MatrixOfExpressions
Matrix having Expression elements.
Definition symbolic-calculus.hh:871
hpp::constraints::QPStaticStability
Definition qp-static-stability.hh:54
hpp::constraints::QPStaticStability::create
static QPStaticStabilityPtr_t create(const std::string &name, const DevicePtr_t &robot, const Contacts_t &contacts, const CenterOfMassComputationPtr_t &com)
hpp::constraints::QPStaticStability::Contacts_t
StaticStability::Contacts_t Contacts_t
Definition qp-static-stability.hh:59
hpp::constraints::QPStaticStability::ForceData
ConvexShapeContact::ForceData ForceData
Definition qp-static-stability.hh:60
hpp::constraints::QPStaticStability::Gravity
static const Eigen::Matrix< value_type, 6, 1 > Gravity
Definition qp-static-stability.hh:56
hpp::constraints::QPStaticStability::create
static QPStaticStabilityPtr_t create(const DevicePtr_t &robot, const Contacts_t &contacts, const CenterOfMassComputationPtr_t &com)
hpp::constraints::QPStaticStability::Contact_t
StaticStability::Contact_t Contact_t
Definition qp-static-stability.hh:58
hpp::constraints::QPStaticStability::create
static QPStaticStabilityPtr_t create(const std::string &name, const DevicePtr_t &robot, const std::vector< ForceData > &contacts, const CenterOfMassComputationPtr_t &com)
hpp::constraints::QPStaticStability::QPStaticStability
QPStaticStability(const std::string &name, const DevicePtr_t &robot, const std::vector< ForceData > &contacts, const CenterOfMassComputationPtr_t &com)
hpp::constraints::QPStaticStability::isEqual
bool isEqual(const DifferentiableFunction &other) const
Definition qp-static-stability.hh:95
hpp::constraints::QPStaticStability::QPStaticStability
QPStaticStability(const std::string &name, const DevicePtr_t &robot, const Contacts_t &contacts, const CenterOfMassComputationPtr_t &com)
hpp::constraints::QPStaticStability::phi
MatrixOfExpressions & phi()
Definition qp-static-stability.hh:92
hpp::constraints::StaticStability::Contacts_t
std::vector< Contact_t > Contacts_t
Definition static-stability.hh:60
hpp::pinocchio::LiegroupElementBase
HPP_CONSTRAINTS_DLLAPI
#define HPP_CONSTRAINTS_DLLAPI
Definition config.hh:88
convex-shape-contact.hh
differentiable-function.hh
fwd.hh
hpp::constraints::DevicePtr_t
pinocchio::DevicePtr_t DevicePtr_t
Definition fwd.hh:111
hpp::constraints::QPStaticStabilityPtr_t
shared_ptr< QPStaticStability > QPStaticStabilityPtr_t
Definition fwd.hh:134
hpp::constraints::ConfigurationIn_t
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition fwd.hh:108
hpp::constraints::matrixOut_t
Eigen::Ref< matrix_t > matrixOut_t
Definition fwd.hh:59
hpp::constraints::CenterOfMassComputationPtr_t
pinocchio::CenterOfMassComputationPtr_t CenterOfMassComputationPtr_t
Definition fwd.hh:114
hpp::constraints::vectorOut_t
pinocchio::vectorOut_t vectorOut_t
Definition fwd.hh:62
hpp::constraints::vector_t
pinocchio::vector_t vector_t
Definition fwd.hh:60
hpp
static-stability.hh
hpp::constraints::ConvexShapeContact::ForceData
Definition convex-shape-contact.hh:117
hpp::constraints::StaticStability::Contact_t
Definition static-stability.hh:49