GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: src/interpolation/com-rrt-shooter.cc Lines: 0 17 0.0 %
Date: 2024-02-02 12:21:48 Branches: 0 20 0.0 %

Line Branch Exec Source
1
// Copyright (c) 2014, LAAS-CNRS
2
// Authors: Steve Tonneau (steve.tonneau@laas.fr)
3
//
4
// This file is part of hpp-rbprm.
5
// hpp-rbprm 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-rbprm 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-rbprm. If not, see <http://www.gnu.org/licenses/>.
16
17
#include <hpp/pinocchio/joint.hh>
18
#include <hpp/rbprm/interpolation/com-rrt-shooter.hh>
19
#include <hpp/rbprm/interpolation/time-constraint-utils.hh>
20
#include <hpp/rbprm/rbprm-limb.hh>
21
#include <hpp/rbprm/sampling/sample.hh>
22
23
namespace hpp {
24
using namespace core;
25
namespace rbprm {
26
namespace interpolation {
27
28
rbprm::T_Limb GetFreeLimbs(const RbPrmFullBodyPtr_t fullBody,
29
                           const hpp::rbprm::State &from,
30
                           const hpp::rbprm::State &to) {
31
  rbprm::T_Limb res;
32
  std::vector<std::string> fixedContacts = to.fixedContacts(from);
33
  std::vector<std::string> variations = to.contactVariations(from);
34
  for (rbprm::CIT_Limb cit = fullBody->GetLimbs().begin();
35
       cit != fullBody->GetLimbs().end(); ++cit) {
36
    if (std::find(fixedContacts.begin(), fixedContacts.end(), cit->first) ==
37
        fixedContacts.end()) {
38
      // std::cout << "adding" << cit->first << std::endl;
39
      // if(std::find(variations.begin(), variations.end(), cit->first) !=
40
      // variations.end())
41
      { res.insert(*cit); }
42
    }
43
  }
44
  return res;
45
}
46
47
TimeConstraintShooterPtr_t ComRRTShooterFactory::operator()(
48
    const RbPrmFullBodyPtr_t fullBody, const hpp::core::PathPtr_t /*comPath*/,
49
    const std::size_t pathDofRank, const hpp::rbprm::State &from,
50
    const hpp::rbprm::State &to, const T_TimeDependant &tds,
51
    core::ConfigProjectorPtr_t projector) const {
52
  return TimeConstraintShooter::create(fullBody->device_, guidePath_,
53
                                       pathDofRank, tds, projector,
54
                                       GetFreeLimbs(fullBody, from, to));
55
}
56
57
TimeConstraintShooterPtr_t EffectorRRTShooterFactory::operator()(
58
    const RbPrmFullBodyPtr_t fullBody, const hpp::core::PathPtr_t /*comPath*/,
59
    const std::size_t pathDofRank, const hpp::rbprm::State & /*from*/,
60
    const hpp::rbprm::State & /*to*/, const T_TimeDependant &tds,
61
    core::ConfigProjectorPtr_t projector) const {
62
  rbprm::T_Limb res;
63
  return TimeConstraintShooter::create(fullBody->device_, guidePath_,
64
                                       pathDofRank, tds, projector, res);
65
}
66
}  // namespace interpolation
67
}  // namespace rbprm
68
}  // namespace hpp