GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/hpp/rbprm/interpolation/time-dependant.hh Lines: 0 6 0.0 %
Date: 2024-02-02 12:21:48 Branches: 0 2 0.0 %

Line Branch Exec Source
1
/// Copyright (c) 2015 CNRS
2
/// Authors: Joseph Mirabel
3
///
4
///
5
// This file is part of hpp-wholebody-step.
6
// hpp-wholebody-step-planner is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU Lesser General Public
8
// License as published by the Free Software Foundation, either version
9
// 3 of the License, or (at your option) any later version.
10
//
11
// hpp-wholebody-step-planner is distributed in the hope that it will be
12
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
// General Lesser Public License for more details. You should have
15
// received a copy of the GNU Lesser General Public License along with
16
// hpp-wholebody-step-planner. If not, see
17
// <http://www.gnu.org/licenses/>.
18
19
#ifndef PP_RBPRM_TIME_DEPENDANT_HH
20
#define PP_RBPRM_TIME_DEPENDANT_HH
21
22
#include <hpp/constraints/implicit.hh>
23
#include <hpp/rbprm/config.hh>
24
#include <vector>
25
26
namespace hpp {
27
namespace rbprm {
28
namespace interpolation {
29
30
/// Time varying right hand side of constraint
31
struct RightHandSideFunctor {
32
  /// Compute and set right hand side of constraint
33
  /// \param eq Implicit constraint,
34
  /// \param input real valued parameter between 0 and 1.
35
  virtual void operator()(constraints::ImplicitPtr_t eq,
36
                          const constraints::value_type& input,
37
                          pinocchio::ConfigurationOut_t conf) const = 0;
38
};
39
typedef shared_ptr<const RightHandSideFunctor> RightHandSideFunctorPtr_t;
40
41
/// Set time varying right hand side of a constraint (constraints::Implicit)
42
///
43
/// This class stores
44
///  \li an instance of implicit constraint and
45
///  \li an instance of time varying right hand side (RightHandSideFunctor)
46
///
47
/// Call to operator () set the right hand side of the constraint to the
48
/// value at a given time.
49
/// \note Parameterization may be normalized between 0 and 1
50
/// (see interpolation::funEvaluator for an example).
51
struct TimeDependant {
52
  /// Set time varying right hand side
53
  /// \param s time value in interval [0,1],
54
  void operator()(const constraints::value_type s,
55
                  pinocchio::ConfigurationOut_t conf) const {
56
    (*rhsFunc_)(eq_, s, conf);
57
  }
58
59
  /// Constructor
60
  /// \param eq implicit constraint,
61
  /// \param rhs time-varying right hand side.
62
  TimeDependant(const constraints::ImplicitPtr_t& eq,
63
                const RightHandSideFunctorPtr_t rhs)
64
      : eq_(eq), rhsFunc_(rhs) {}
65
66
  TimeDependant(const TimeDependant& other)
67
      : eq_(other.eq_), rhsFunc_(other.rhsFunc_) {}
68
69
  constraints::ImplicitPtr_t eq_;
70
  RightHandSideFunctorPtr_t rhsFunc_;
71
};  // class TimeDependant
72
73
typedef std::vector<TimeDependant> T_TimeDependant;
74
typedef T_TimeDependant::const_iterator CIT_TimeDependant;
75
}  // namespace interpolation
76
}  // namespace rbprm
77
}  // namespace hpp
78
#endif  // PP_RBPRM_TIME_DEPENDANT_HH