hpp-constraints: include/hpp/constraints/function/of-parameter-subset.hh Source File

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

Loading...
Searching...
No Matches
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
32#include <hpp/constraints/differentiable-function.hh>
33
34 namespace hpp {
35 namespace constraints {
36 namespace function {
51 class HPP_CONSTRAINTS_DLLAPI OfParameterSubset : public DifferentiableFunction {
52 public:
60 static OfParameterSubsetPtr_t create(const DifferentiableFunctionPtr_t& g,
61 const size_type& nArgs,
62 const size_type& nDers,
63 const segment_t& inArgs,
64 const segment_t& inDers) {
65 return OfParameterSubsetPtr_t(
66 new OfParameterSubset(g, nArgs, nDers, inArgs, inDers));
67 }
68
69 protected:
77 OfParameterSubset(const DifferentiableFunctionPtr_t& g,
78 const size_type& nArgs, const size_type& nDers,
79 const segment_t& inArgs, const segment_t& inDers);
80
81 void impl_compute(LiegroupElementRef y, vectorIn_t arg) const {
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
104 DifferentiableFunctionPtr_t g_;
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
hpp::constraints::DifferentiableFunction
Definition differentiable-function.hh:63
hpp::constraints::function::OfParameterSubset
Definition of-parameter-subset.hh:51
hpp::constraints::function::OfParameterSubset::isEqual
bool isEqual(const DifferentiableFunction &other) const
Definition of-parameter-subset.hh:90
hpp::constraints::function::OfParameterSubset::impl_compute
void impl_compute(LiegroupElementRef y, vectorIn_t arg) const
User implementation of function evaluation.
Definition of-parameter-subset.hh:81
hpp::constraints::function::OfParameterSubset::print
std::ostream & print(std::ostream &os) const
Display object in a stream.
hpp::constraints::function::OfParameterSubset::impl_jacobian
void impl_jacobian(matrixOut_t J, vectorIn_t arg) const
Definition of-parameter-subset.hh:85
hpp::constraints::function::OfParameterSubset::sa_
const segment_t sa_
Definition of-parameter-subset.hh:105
hpp::constraints::function::OfParameterSubset::create
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
hpp::constraints::function::OfParameterSubset::g_
DifferentiableFunctionPtr_t g_
Definition of-parameter-subset.hh:104
hpp::constraints::function::OfParameterSubset::sd_
const segment_t sd_
Definition of-parameter-subset.hh:105
hpp::constraints::function::OfParameterSubset::OfParameterSubset
OfParameterSubset(const DifferentiableFunctionPtr_t &g, const size_type &nArgs, const size_type &nDers, const segment_t &inArgs, const segment_t &inDers)
hpp::pinocchio::LiegroupElementBase
HPP_CONSTRAINTS_DLLAPI
#define HPP_CONSTRAINTS_DLLAPI
Definition config.hh:88
differentiable-function.hh
hpp::constraints::function::OfParameterSubsetPtr_t
shared_ptr< OfParameterSubset > OfParameterSubsetPtr_t
Definition fwd.hh:215
hpp::constraints::DifferentiableFunctionPtr_t
shared_ptr< DifferentiableFunction > DifferentiableFunctionPtr_t
Definition fwd.hh:115
hpp::constraints::segment_t
std::pair< size_type, size_type > segment_t
Definition fwd.hh:84
hpp::constraints::size_type
pinocchio::size_type size_type
Definition fwd.hh:48
hpp::constraints::vectorIn_t
pinocchio::vectorIn_t vectorIn_t
Definition fwd.hh:61
hpp::constraints::matrixOut_t
Eigen::Ref< matrix_t > matrixOut_t
Definition fwd.hh:59
hpp