hpp-constraints  4.9.1
Definition of basic geometric constraints for motion planning
difference.hh
Go to the documentation of this file.
1 // Copyright (c) 2018, 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_FUNCTION_DIFFERENCE_HH
18 # define HPP_CONSTRAINTS_FUNCTION_DIFFERENCE_HH
19 
20 # include <hpp/constraints/config.hh>
22 # include <hpp/constraints/fwd.hh>
23 
24 namespace hpp {
25  namespace constraints {
26  namespace function {
27  class Difference;
28  typedef boost::shared_ptr<Difference> DifferencePtr_t;
29 
32  class HPP_CONSTRAINTS_LOCAL Difference :
34  {
35  public:
36  typedef boost::shared_ptr<Difference> Ptr_t;
38  const size_type& nArgs, const size_type& nDers,
39  const segment_t& lInArgs, const segment_t& lInDers,
40  const segment_t& rInArgs, const segment_t& rInDers);
41 
42  protected:
44  {
45  inner_->value(l_, arg.segment (lsa_.first, lsa_.second));
46  inner_->value(r_, arg.segment (rsa_.first, rsa_.second));
47  y.vector() = l_ - r_;
48  }
49 
50  void impl_jacobian (matrixOut_t J, vectorIn_t arg) const
51  {
52  inner_->jacobian(
53  J.middleCols (lsd_.first, lsd_.second),
54  arg.segment (lsa_.first, lsa_.second));
55  inner_->jacobian(
56  J.middleCols (rsd_.first, rsd_.second),
57  arg.segment (rsa_.first, rsa_.second));
58  J.middleCols (rsd_.first, rsd_.second) *= -1;
59  }
60 
61  std::ostream& print (std::ostream& os) const;
62 
64  const segment_t lsa_, lsd_;
65  const segment_t rsa_, rsd_;
66 
67  mutable LiegroupElement l_, r_;
68  }; // class Difference
69  } // namespace function
70  } // namespace constraints
71 } // namespace hpp
72 
73 #endif // HPP_CONSTRAINTS_FUNCTION_DIFFERENCE_HH
pinocchio::vectorIn_t vectorIn_t
Definition: fwd.hh:46
void impl_compute(LiegroupElementRef y, vectorIn_t arg) const
User implementation of function evaluation.
Definition: difference.hh:43
const vector_type & vector() const
DifferentiableFunctionPtr_t inner_
Definition: difference.hh:63
std::pair< size_type, size_type > segment_t
Definition: fwd.hh:68
void impl_jacobian(matrixOut_t J, vectorIn_t arg) const
Definition: difference.hh:50
boost::shared_ptr< Difference > Ptr_t
Definition: difference.hh:36
const segment_t rsd_
Definition: difference.hh:65
Definition: difference.hh:32
const segment_t lsd_
Definition: difference.hh:64
Definition: differentiable-function.hh:50
boost::shared_ptr< DifferentiableFunction > DifferentiableFunctionPtr_t
Definition: fwd.hh:95
LiegroupElement r_
Definition: difference.hh:67
pinocchio::size_type size_type
Definition: fwd.hh:35
Eigen::Ref< matrix_t > matrixOut_t
Definition: fwd.hh:44
boost::shared_ptr< Difference > DifferencePtr_t
Definition: difference.hh:27