GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/hpp/rbprm/contact_generation/contact_generation.hh Lines: 0 1 0.0 %
Date: 2024-02-02 12:21:48 Branches: 0 0 - %

Line Branch Exec Source
1
/// Copyright (c) 2017 CNRS
2
/// Authors: stonneau
3
///
4
///
5
// This file is part of hpp-rbprm.
6
// hpp-rbprm 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 HPP_RBPRM_CONTACT_GENERATION_HH
20
#define HPP_RBPRM_CONTACT_GENERATION_HH
21
22
#include <hpp/rbprm/projection/projection.hh>
23
#include <hpp/rbprm/rbprm-fullbody.hh>
24
#include <hpp/rbprm/rbprm-state.hh>
25
#include <queue>
26
27
namespace hpp {
28
namespace rbprm {
29
namespace contact {
30
31
typedef std::queue<hpp::rbprm::State> Q_State;
32
typedef std::pair<hpp::rbprm::State, std::vector<std::string> > ContactState;
33
typedef std::queue<ContactState> T_ContactState;
34
35
struct ContactGenHelper {
36
  ContactGenHelper(
37
      RbPrmFullBodyPtr_t fb, const State& ps,
38
      pinocchio::ConfigurationIn_t configuration, const affMap_t& affordances,
39
      const std::map<std::string, std::vector<std::string> >& affFilters,
40
      const double robustnessTreshold = 0,
41
      const std::size_t maxContactBreaks = 1,
42
      const std::size_t maxContactCreations = 1,
43
      const bool checkStabilityMaintain = false,
44
      const bool checkStabilityGenerate = true,
45
      const fcl::Vec3f& direction = fcl::Vec3f(0, 0, 1),
46
      const fcl::Vec3f& acceleration = fcl::Vec3f(0, 0, 0),
47
      const bool contactIfFails = false, const bool stableForOneContact = false,
48
      const core::PathConstPtr_t& comPath = core::PathConstPtr_t(),
49
      const double currentPathId = 0);
50
  ~ContactGenHelper() {}
51
  hpp::rbprm::RbPrmFullBodyPtr_t fullBody_;
52
  const hpp::rbprm::State previousState_;
53
  const bool checkStabilityMaintain_;
54
  bool contactIfFails_;
55
  const bool stableForOneContact_;
56
  const fcl::Vec3f acceleration_;
57
  const fcl::Vec3f direction_;
58
  const double robustnessTreshold_;
59
  const std::size_t maxContactBreaks_;
60
  const std::size_t maxContactCreations_;
61
  const affMap_t& affordances_;
62
  const std::map<std::string, std::vector<std::string> >& affFilters_;
63
  hpp::rbprm::State workingState_;
64
  bool checkStabilityGenerate_;
65
  Q_State candidates_;
66
  const core::PathConstPtr_t comPath_;
67
  const double currentPathId_;
68
  bool quasiStatic_;
69
  bool testReachability_;
70
  const bool maximiseContacts_;
71
  const bool accept_unreachable_;
72
  const bool tryQuasiStatic_;
73
  const int reachabilityPointPerPhases_;
74
};
75
76
std::vector<hpp::pinocchio::CollisionObjectPtr_t> HPP_RBPRM_DLLAPI
77
getAffObjectsForLimb(
78
    const std::string& limb, const affMap_t& affordances,
79
    const std::map<std::string, std::vector<std::string> >& affFilters);
80
81
/// Generates all potentially valid cases of valid contact maintenance
82
/// given a previous configuration.
83
/// \param fullBody target Robot
84
/// \param target, desired root position
85
/// \param currentState current state of the robot (configuration and contacts)
86
/// \param maxBrokenContacts max number of contacts that can be broken in the
87
/// process \return a queue of contact states candidates for maintenance,
88
/// ordered by number of contacts broken and priority in the list wrt the
89
/// contact order
90
Q_State maintain_contacts_combinatorial(
91
    const hpp::rbprm::State& currentState,
92
    const std::size_t maxBrokenContacts = 1);
93
94
/// Generates all potentially valid cases of valid contact creation by removing
95
/// the top state of the priority stack \param freeEffectors list of free
96
/// candidates \param previous current state of the robot \param
97
/// maxCreatedContacts max number of contacts that can be created in the process
98
/// \return a QUEUE of contact states candidates for maintenance, ordered by
99
/// number of contacts broken and priority in the list wrt the contact order
100
T_ContactState gen_contacts_combinatorial(
101
    const std::vector<std::string>& freeEffectors, const State& previous,
102
    const std::size_t maxCreatedContacts, const bool maximiseContacts = false);
103
104
/// Given a combinatorial of possible contacts, generate
105
/// the first "valid" configuration, that is the first kinematic
106
/// configuration that removes the minimum number of contacts and
107
/// is collision free.
108
/// \param ContactGenHelper parametrization of the planner
109
/// \return the best candidate wrt the priority in the list and the contact
110
/// order
111
projection::ProjectionReport maintain_contacts(
112
    ContactGenHelper& contactGenHelper);
113
114
/// Given a current state and an effector, tries to generate a contact
115
/// configuration. \param ContactGenHelper parametrization of the planner \param
116
/// limb the limb to create a contact with \return the best candidate wrt the
117
/// priority in the list and the contact order
118
projection::ProjectionReport generate_contact(
119
    const ContactGenHelper& contactGenHelper, const std::string& limb,
120
    sampling::HeuristicParam& params, const sampling::heuristic evaluate = 0);
121
122
/// Given a combinatorial of possible contacts, generate
123
/// the first "valid" contact configuration, that is the first contact
124
/// configuration is contact and equilibrium.
125
/// \param ContactGenHelper parametrization of the planner
126
/// \return the best candidate wrt the priority in the list and the contact
127
/// order
128
projection::ProjectionReport gen_contacts(ContactGenHelper& contactGenHelper);
129
130
/// Tries to reposition one contact of a given state into
131
/// a new one, more balanced
132
/// \param ContactGenHelper parametrization of the planner
133
/// \return the best candidate wrt the priority in the list and the contact
134
/// order
135
projection::ProjectionReport repositionContacts(
136
    ContactGenHelper& contactGenHelper);
137
}  // namespace contact
138
}  // namespace rbprm
139
}  // namespace hpp
140
#endif  // HPP_RBPRM_CONTACT_GENERATION_HH