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

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

Loading...
Searching...
No Matches
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
32#include <hpp/constraints/config.hh>
33#include <hpp/constraints/deprecated.hh>
34#include <hpp/constraints/differentiable-function.hh>
35#include <hpp/constraints/fwd.hh>
36#include <hpp/constraints/symbolic-calculus.hh>
37#include <vector>
38
39 namespace hpp {
40 namespace constraints {
41
44 class HPP_CONSTRAINTS_DLLAPI StaticStability : public DifferentiableFunction {
45 public:
46 static const value_type G;
47 static const Eigen::Matrix<value_type, 6, 1> Gravity;
48
49 struct Contact_t {
50 JointPtr_t joint;
51 vector3_t point;
52 vector3_t normal;
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
74 static StaticStabilityPtr_t create(const DevicePtr_t& robot,
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_;
116 CenterOfMassComputationPtr_t com_;
117
118 typedef MatrixOfExpressions<eigen::vector3_t, JacobianMatrix> MoE_t;
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
hpp::constraints::DifferentiableFunction
Definition differentiable-function.hh:63
hpp::constraints::MatrixOfExpressions
Matrix having Expression elements.
Definition symbolic-calculus.hh:871
hpp::constraints::StaticStability
Definition static-stability.hh:44
hpp::constraints::StaticStability::create
static StaticStabilityPtr_t create(const DevicePtr_t &robot, const Contacts_t &contacts, const CenterOfMassComputationPtr_t &com)
hpp::constraints::StaticStability::StaticStability
StaticStability(const std::string &name, const DevicePtr_t &robot, const Contacts_t &contacts, const CenterOfMassComputationPtr_t &com)
hpp::constraints::StaticStability::Gravity
static const Eigen::Matrix< value_type, 6, 1 > Gravity
Definition static-stability.hh:47
hpp::constraints::StaticStability::isEqual
bool isEqual(const DifferentiableFunction &other) const
Definition static-stability.hh:81
hpp::constraints::StaticStability::Contacts_t
std::vector< Contact_t > Contacts_t
Definition static-stability.hh:60
hpp::constraints::StaticStability::create
static StaticStabilityPtr_t create(const std::string &name, const DevicePtr_t &robot, const Contacts_t &contacts, const CenterOfMassComputationPtr_t &com)
hpp::constraints::StaticStability::G
static const value_type G
Definition static-stability.hh:46
hpp::constraints::StaticStability::phi
MatrixOfExpressions & phi()
Definition static-stability.hh:78
hpp::pinocchio::LiegroupElementBase
config.hh
HPP_CONSTRAINTS_DLLAPI
#define HPP_CONSTRAINTS_DLLAPI
Definition config.hh:88
deprecated.hh
differentiable-function.hh
fwd.hh
hpp::constraints::vector3_t
pinocchio::vector3_t vector3_t
Definition fwd.hh:53
hpp::constraints::DevicePtr_t
pinocchio::DevicePtr_t DevicePtr_t
Definition fwd.hh:111
hpp::constraints::size_type
pinocchio::size_type size_type
Definition fwd.hh:48
hpp::constraints::value_type
pinocchio::value_type value_type
Definition fwd.hh:49
hpp::constraints::StaticStabilityPtr_t
shared_ptr< StaticStability > StaticStabilityPtr_t
Definition fwd.hh:133
hpp::constraints::vectorIn_t
pinocchio::vectorIn_t vectorIn_t
Definition fwd.hh:61
hpp::constraints::ConfigurationIn_t
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition fwd.hh:108
hpp::constraints::matrix_t
pinocchio::matrix_t matrix_t
Definition fwd.hh:57
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::matrixIn_t
Eigen::Ref< const matrix_t > matrixIn_t
Definition fwd.hh:58
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::constraints::JointPtr_t
pinocchio::JointPtr_t JointPtr_t
Definition fwd.hh:50
hpp
hpp::constraints::StaticStability::Contact_t
Definition static-stability.hh:49
hpp::constraints::StaticStability::Contact_t::normal
vector3_t normal
Definition static-stability.hh:52
hpp::constraints::StaticStability::Contact_t::operator==
bool operator==(Contact_t const &other) const
Definition static-stability.hh:53
hpp::constraints::StaticStability::Contact_t::joint
JointPtr_t joint
Definition static-stability.hh:50
hpp::constraints::StaticStability::Contact_t::point
vector3_t point
Definition static-stability.hh:51
symbolic-calculus.hh