hpp-constraints  6.0.0
Definition of basic geometric constraints for motion planning
of-parameter-subset.hh
Go to the documentation of this file.
1 // Copyright (c) 2017 - 2018, CNRS
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr), Florent Lamiraux
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_FUNCTION_OF_PARAMETER_SUBSET_HH
30 #define HPP_CONSTRAINTS_FUNCTION_OF_PARAMETER_SUBSET_HH
31 
33 
34 namespace hpp {
35 namespace constraints {
36 namespace function {
52  public:
61  const size_type& nArgs,
62  const size_type& nDers,
63  const segment_t& inArgs,
64  const segment_t& inDers) {
66  new OfParameterSubset(g, nArgs, nDers, inArgs, inDers));
67  }
68 
69  protected:
78  const size_type& nArgs, const size_type& nDers,
79  const segment_t& inArgs, const segment_t& inDers);
80 
82  g_->value(y, arg.segment(sa_.first, sa_.second));
83  }
84 
85  void impl_jacobian(matrixOut_t J, vectorIn_t arg) const {
86  g_->jacobian(J.middleCols(sd_.first, sd_.second),
87  arg.segment(sa_.first, sa_.second));
88  }
89 
90  bool isEqual(const DifferentiableFunction& other) const {
91  const OfParameterSubset& castother =
92  dynamic_cast<const OfParameterSubset&>(other);
93  if (!DifferentiableFunction::isEqual(other)) return false;
94 
95  if (g_ != castother.g_) return false;
96  if (sa_ != castother.sa_) return false;
97  if (sd_ != castother.sd_) return false;
98 
99  return true;
100  }
101 
102  std::ostream& print(std::ostream& os) const;
103 
105  const segment_t sa_, sd_;
106 }; // class OfParameterSubset
107 } // namespace function
108 } // namespace constraints
109 } // namespace hpp
110 #endif // HPP_CONSTRAINTS_FUNCTION_OF_PARAMETER_SUBSET_HH
Definition: differentiable-function.hh:63
virtual bool isEqual(const DifferentiableFunction &other) const
Definition: differentiable-function.hh:206
Definition: of-parameter-subset.hh:51
bool isEqual(const DifferentiableFunction &other) const
Definition: of-parameter-subset.hh:90
void impl_compute(LiegroupElementRef y, vectorIn_t arg) const
User implementation of function evaluation.
Definition: of-parameter-subset.hh:81
void impl_jacobian(matrixOut_t J, vectorIn_t arg) const
Definition: of-parameter-subset.hh:85
const segment_t sa_
Definition: of-parameter-subset.hh:105
std::ostream & print(std::ostream &os) const
Display object in a stream.
static OfParameterSubsetPtr_t create(const DifferentiableFunctionPtr_t &g, const size_type &nArgs, const size_type &nDers, const segment_t &inArgs, const segment_t &inDers)
Definition: of-parameter-subset.hh:60
DifferentiableFunctionPtr_t g_
Definition: of-parameter-subset.hh:104
const segment_t sd_
Definition: of-parameter-subset.hh:105
OfParameterSubset(const DifferentiableFunctionPtr_t &g, const size_type &nArgs, const size_type &nDers, const segment_t &inArgs, const segment_t &inDers)
#define HPP_CONSTRAINTS_DLLAPI
Definition: config.hh:88
shared_ptr< OfParameterSubset > OfParameterSubsetPtr_t
Definition: fwd.hh:211
shared_ptr< DifferentiableFunction > DifferentiableFunctionPtr_t
Definition: fwd.hh:113
std::pair< size_type, size_type > segment_t
Definition: fwd.hh:83
pinocchio::size_type size_type
Definition: fwd.hh:47
pinocchio::vectorIn_t vectorIn_t
Definition: fwd.hh:60
Eigen::Ref< matrix_t > matrixOut_t
Definition: fwd.hh:58
pinocchio::LiegroupElementRef LiegroupElementRef
Definition: fwd.hh:66
Definition: active-set-differentiable-function.hh:36