hpp-constraints  6.0.0
Definition of basic geometric constraints for motion planning
static-stability.hh
Go to the documentation of this file.
1 // Copyright (c) 2014, 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_STATIC_STABILITY_HH
30 #define HPP_CONSTRAINTS_STATIC_STABILITY_HH
31 
35 #include <hpp/constraints/fwd.hh>
37 #include <vector>
38 
39 namespace hpp {
40 namespace constraints {
41 
45  public:
46  static const value_type G;
47  static const Eigen::Matrix<value_type, 6, 1> Gravity;
48 
49  struct Contact_t {
53  bool operator==(Contact_t const& other) const {
54  if (joint != other.joint) return false;
55  if (point != other.point) return false;
56  if (normal != other.normal) return false;
57  return true;
58  }
59  };
60  typedef std::vector<Contact_t> Contacts_t;
61 
65  StaticStability(const std::string& name, const DevicePtr_t& robot,
66  const Contacts_t& contacts,
67  const CenterOfMassComputationPtr_t& com);
68 
69  static StaticStabilityPtr_t create(const std::string& name,
70  const DevicePtr_t& robot,
71  const Contacts_t& contacts,
72  const CenterOfMassComputationPtr_t& com);
73 
75  const Contacts_t& contacts,
76  const CenterOfMassComputationPtr_t& com);
77 
78  MatrixOfExpressions<>& phi() { return phi_; }
79 
80  protected:
81  bool isEqual(const DifferentiableFunction& other) const {
82  const StaticStability& castother =
83  dynamic_cast<const StaticStability&>(other);
84  if (!DifferentiableFunction::isEqual(other)) return false;
85 
86  if (robot_ != castother.robot_) return false;
87  if (contacts_ != castother.contacts_) return false;
88  if (com_ != castother.com_) return false;
89 
90  return true;
91  }
92 
93  private:
94  void impl_compute(LiegroupElementRef result,
95  ConfigurationIn_t argument) const;
96 
97  void impl_jacobian(matrixOut_t jacobian, ConfigurationIn_t argument) const;
98 
99  static void findBoundIndex(vectorIn_t u, vectorIn_t v, value_type& lambdaMin,
100  size_type* iMin, value_type& lambdaMax,
101  size_type* iMax);
102 
104  bool computeUminusAndV(vectorIn_t u, vectorOut_t uMinus, vectorOut_t v) const;
105 
106  void computeVDot(const ConfigurationIn_t arg, vectorIn_t uMinus, vectorIn_t S,
107  matrixIn_t uDot, matrixOut_t uMinusDot,
108  matrixOut_t vDot) const;
109 
110  void computeLambdaDot(vectorIn_t u, vectorIn_t v, const std::size_t i0,
111  matrixIn_t uDot, matrixIn_t vDot,
112  vectorOut_t lambdaDot) const;
113 
114  DevicePtr_t robot_;
115  Contacts_t contacts_;
117 
119 
120  mutable MoE_t phi_;
121  mutable vector_t u_, uMinus_, v_;
122  mutable matrix_t uDot_, uMinusDot_, vDot_;
123  mutable vector_t lambdaDot_;
124 };
126 } // namespace constraints
127 } // namespace hpp
128 
129 #endif // HPP_CONSTRAINTS_STATIC_STABILITY_HH
Definition: differentiable-function.hh:63
virtual bool isEqual(const DifferentiableFunction &other) const
Definition: differentiable-function.hh:206
Matrix having Expression elements.
Definition: symbolic-calculus.hh:871
Definition: static-stability.hh:44
static StaticStabilityPtr_t create(const DevicePtr_t &robot, const Contacts_t &contacts, const CenterOfMassComputationPtr_t &com)
MatrixOfExpressions & phi()
Definition: static-stability.hh:78
StaticStability(const std::string &name, const DevicePtr_t &robot, const Contacts_t &contacts, const CenterOfMassComputationPtr_t &com)
static const Eigen::Matrix< value_type, 6, 1 > Gravity
Definition: static-stability.hh:47
bool isEqual(const DifferentiableFunction &other) const
Definition: static-stability.hh:81
std::vector< Contact_t > Contacts_t
Definition: static-stability.hh:60
static StaticStabilityPtr_t create(const std::string &name, const DevicePtr_t &robot, const Contacts_t &contacts, const CenterOfMassComputationPtr_t &com)
static const value_type G
Definition: static-stability.hh:46
#define HPP_CONSTRAINTS_DLLAPI
Definition: config.hh:88
pinocchio::vector3_t vector3_t
Definition: fwd.hh:52
pinocchio::DevicePtr_t DevicePtr_t
Definition: fwd.hh:109
pinocchio::size_type size_type
Definition: fwd.hh:47
pinocchio::value_type value_type
Definition: fwd.hh:48
shared_ptr< StaticStability > StaticStabilityPtr_t
Definition: fwd.hh:131
pinocchio::vectorIn_t vectorIn_t
Definition: fwd.hh:60
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:106
pinocchio::matrix_t matrix_t
Definition: fwd.hh:56
Eigen::Ref< matrix_t > matrixOut_t
Definition: fwd.hh:58
pinocchio::CenterOfMassComputationPtr_t CenterOfMassComputationPtr_t
Definition: fwd.hh:112
Eigen::Ref< const matrix_t > matrixIn_t
Definition: fwd.hh:57
pinocchio::vectorOut_t vectorOut_t
Definition: fwd.hh:61
pinocchio::vector_t vector_t
Definition: fwd.hh:59
pinocchio::LiegroupElementRef LiegroupElementRef
Definition: fwd.hh:66
pinocchio::JointPtr_t JointPtr_t
Definition: fwd.hh:49
Definition: active-set-differentiable-function.hh:36
Definition: static-stability.hh:49
vector3_t normal
Definition: static-stability.hh:52
bool operator==(Contact_t const &other) const
Definition: static-stability.hh:53
JointPtr_t joint
Definition: static-stability.hh:50
vector3_t point
Definition: static-stability.hh:51