GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: src/interpolation/limb-rrt-shooter.cc Lines: 0 13 0.0 %
Date: 2024-02-02 12:21:48 Branches: 0 16 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/rbprm/interpolation/limb-rrt-shooter.hh>
18
#include <hpp/rbprm/interpolation/time-constraint-utils.hh>
19
#include <hpp/rbprm/rbprm-limb.hh>
20
#include <hpp/rbprm/sampling/sample.hh>
21
22
namespace hpp {
23
using namespace core;
24
namespace rbprm {
25
namespace interpolation {
26
27
rbprm::T_Limb GetVaryingLimb(const RbPrmFullBodyPtr_t fullBody,
28
                             const hpp::rbprm::State &from,
29
                             const hpp::rbprm::State &to) {
30
  /*rbprm::T_Limb res;
31
  const rbprm::T_Limb& limbs = fullBody->GetLimbs();
32
  std::vector<std::string> variations = to.allVariations(from,
33
  extractEffectorsName(limbs)); if(!variations.empty())
34
  {
35
      const std::string limbName = *(variations.begin());
36
      rbprm::RbPrmLimbPtr_t limb = limbs.at(limbName);
37
      res.insert(std::make_pair(limbName,limb));
38
  }
39
  return res;*/
40
  rbprm::T_Limb res;
41
  std::vector<std::string> fixedContacts = to.fixedContacts(from);
42
  std::vector<std::string> variations = to.contactVariations(from);
43
  for (rbprm::CIT_Limb cit = fullBody->GetLimbs().begin();
44
       cit != fullBody->GetLimbs().end(); ++cit) {
45
    if (std::find(fixedContacts.begin(), fixedContacts.end(), cit->first) ==
46
        fixedContacts.end()) {
47
      // if(std::find(variations.begin(), variations.end(), cit->first) !=
48
      // variations.end())
49
      { res.insert(*cit); }
50
    }
51
  }
52
  return res;
53
}
54
55
TimeConstraintShooterPtr_t LimbRRTShooterFactory::operator()(
56
    const RbPrmFullBodyPtr_t fullBody, const hpp::core::PathPtr_t path,
57
    const std::size_t pathDofRank, const hpp::rbprm::State &from,
58
    const hpp::rbprm::State &to, const T_TimeDependant &tds,
59
    core::ConfigProjectorPtr_t projector) const {
60
  return TimeConstraintShooter::create(fullBody->device_, path, pathDofRank,
61
                                       tds, projector,
62
                                       GetVaryingLimb(fullBody, from, to));
63
}
64
}  // namespace interpolation
65
}  // namespace rbprm
66
}  // namespace hpp