hpp-constraints  4.9.1
Definition of basic geometric constraints for motion planning
active-set-differentiable-function.hh
Go to the documentation of this file.
1 // Copyright (c) 2017, Joseph Mirabel
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3 //
4 // This file is part of hpp-constraints.
5 // hpp-constraints is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 //
10 // hpp-constraints is distributed in the hope that it will be
11 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Lesser Public License for more details. You should have
14 // received a copy of the GNU Lesser General Public License along with
15 // hpp-constraints. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef HPP_CONSTRAINTS_ACTIVE_SET_DIFFERENTIABLE_FUNCTION_HH
18 #define HPP_CONSTRAINTS_ACTIVE_SET_DIFFERENTIABLE_FUNCTION_HH
19 
20 #include <hpp/constraints/fwd.hh>
21 #include <hpp/constraints/config.hh>
23 
24 namespace hpp {
25  namespace constraints {
26 
35  class HPP_CONSTRAINTS_DLLAPI ActiveSetDifferentiableFunction :
37  {
38  public:
44  segments_t intervals)
46  f->inputSize(), f->inputDerivativeSize(),
47  f->outputSpace (),
48  "ActiveSet_on_" + f->name ())
49  , function_(f)
50  , intervals_(intervals)
51  {
52  context (f->context());
53  }
54 
56  const DifferentiableFunction& function() const
57  {
58  return *function_;
59  }
60 
63  {
64  return function_;
65  }
66 
67  protected:
68  typedef std::vector < segments_t > intervalss_t;
69 
71  virtual void impl_compute (LiegroupElementRef result,
72  vectorIn_t argument) const
73  {
74  function_->value(result, argument);
75  }
76 
77  virtual void impl_jacobian (matrixOut_t jacobian,
78  vectorIn_t arg) const
79  {
80  function_->jacobian(jacobian, arg);
81  for (segments_t::const_iterator _int = intervals_.begin ();
82  _int != intervals_.end (); ++_int)
83  jacobian.middleCols (_int->first, _int->second).setZero ();
84  }
85 
88  }; // class ActiveSetDifferentiableFunction
89  } // namespace constraints
90 } // namespace hpp
91 
92 #endif // HPP_CONSTRAINTS_ACTIVE_SET_DIFFERENTIABLE_FUNCTION_HH
pinocchio::vectorIn_t vectorIn_t
Definition: fwd.hh:46
std::vector< segment_t > segments_t
Definition: fwd.hh:69
std::vector< segments_t > intervalss_t
Definition: active-set-differentiable-function.hh:68
segments_t intervals_
Definition: active-set-differentiable-function.hh:87
DifferentiableFunctionPtr_t function_
Definition: active-set-differentiable-function.hh:86
ActiveSetDifferentiableFunction(const DifferentiableFunctionPtr_t &f, segments_t intervals)
Definition: active-set-differentiable-function.hh:43
Definition: differentiable-function.hh:50
boost::shared_ptr< DifferentiableFunction > DifferentiableFunctionPtr_t
Definition: fwd.hh:95
Eigen::Ref< matrix_t > matrixOut_t
Definition: fwd.hh:44
virtual void impl_jacobian(matrixOut_t jacobian, vectorIn_t arg) const
Definition: active-set-differentiable-function.hh:77
virtual void impl_compute(LiegroupElementRef result, vectorIn_t argument) const
User implementation of function evaluation.
Definition: active-set-differentiable-function.hh:71
Definition: active-set-differentiable-function.hh:35
const DifferentiableFunctionPtr_t & functionPtr() const
Get the original function.
Definition: active-set-differentiable-function.hh:62