hpp-rbprm  4.12.0
Implementation of RB-PRM planner using hpp.
rbprm-steering-kinodynamic.hh
Go to the documentation of this file.
1 // Copyright (c) 2016, LAAS-CNRS
2 // Authors: Pierre Fernbach (pierre.fernbach@laas.fr)
3 //
4 // This file is part of hpp-core
5 // hpp-core 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-core 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-core If not, see
16 // <http://www.gnu.org/licenses/>.
17 
18 #ifndef HPP_RBPRM_STEERING_METHOD_KINODYNAMIC_HH
19 #define HPP_RBPRM_STEERING_METHOD_KINODYNAMIC_HH
20 
21 #include <hpp/rbprm/config.hh>
22 #include <hpp/core/steering-method/steering-kinodynamic.hh>
24 
25 namespace hpp {
26 namespace rbprm {
27 
28 using core::ConfigurationIn_t;
29 using core::Path;
30 using core::Problem;
31 
32 HPP_PREDEF_CLASS(SteeringMethodKinodynamic);
33 typedef std::shared_ptr<SteeringMethodKinodynamic> SteeringMethodKinodynamicPtr_t;
34 
35 class HPP_RBPRM_DLLAPI SteeringMethodKinodynamic : public core::steeringMethod::Kinodynamic {
36  public:
37  core::PathPtr_t operator()(core::ConfigurationIn_t q1, const core::NodePtr_t x) {
38  try {
39  return impl_compute(q1, x);
40  } catch (const core::projection_error& e) {
41  hppDout(info, "Could not build path: " << e.what());
42  }
43  return core::PathPtr_t();
44  }
45 
46  core::PathPtr_t operator()(const core::NodePtr_t x, core::ConfigurationIn_t q2) {
47  try {
48  return impl_compute(x, q2);
49  } catch (const core::projection_error& e) {
50  hppDout(info, "Could not build path: " << e.what());
51  }
52  return core::PathPtr_t();
53  }
55  static SteeringMethodKinodynamicPtr_t create(core::ProblemConstPtr_t problem) {
57  SteeringMethodKinodynamicPtr_t shPtr(ptr);
58  ptr->init(shPtr);
59  return shPtr;
60  }
61 
63  static SteeringMethodKinodynamicPtr_t createCopy(const SteeringMethodKinodynamicPtr_t& other) {
65  SteeringMethodKinodynamicPtr_t shPtr(ptr);
66  ptr->init(shPtr);
67  return shPtr;
68  }
69 
71  virtual core::SteeringMethodPtr_t copy() const { return createCopy(weak_.lock()); }
72 
74  virtual core::PathPtr_t impl_compute(core::ConfigurationIn_t q1, core::ConfigurationIn_t q2) const;
75 
76  core::PathPtr_t impl_compute(core::NodePtr_t x, core::ConfigurationIn_t q2);
77 
78  core::PathPtr_t impl_compute(core::ConfigurationIn_t q1, core::NodePtr_t x);
79 
82  int dirValid_;
83  int dirTotal_;
85  const double maxLength_;
86 
87  protected:
89  SteeringMethodKinodynamic(core::ProblemConstPtr_t problem);
90 
93 
95  void init(SteeringMethodKinodynamicWkPtr_t weak) {
96  core::SteeringMethod::init(weak);
97  weak_ = weak;
98  }
99 
106  core::PathPtr_t computeDirection(const core::ConfigurationIn_t from, const core::ConfigurationIn_t to, bool reverse);
107 
116  core::PathPtr_t setSteeringMethodBounds(const core::RbprmNodePtr_t& near, const core::ConfigurationIn_t target,
117  bool reverse);
118 
119  private:
120  core::DeviceWkPtr_t device_;
121  centroidal_dynamics::Vector3 lastDirection_;
122  centroidal_dynamics::Equilibrium* sEq_;
123  bool boundsUpToDate_;
124  SteeringMethodKinodynamicWkPtr_t weak_;
125 
126 }; // class rbprm-kinodynamic
127 } // namespace rbprm
128 } // namespace hpp
129 
130 #endif // HPP_RBPRM_STEERING_METHOD_KINODYNAMIC_HH
Eigen::Matrix< pinocchio::value_type, 3, 1 > Vector3
Definition: rbprm-limb.hh:48
#define HPP_RBPRM_DLLAPI
Definition: config.hh:64
Definition: algorithm.hh:27
double totalTimeComputed_
Definition: rbprm-steering-kinodynamic.hh:80
virtual core::SteeringMethodPtr_t copy() const
Copy instance and return shared pointer.
Definition: rbprm-steering-kinodynamic.hh:71
Definition: rbprm-node.hh:22
std::shared_ptr< SteeringMethodKinodynamic > SteeringMethodKinodynamicPtr_t
Definition: rbprm-steering-kinodynamic.hh:33
Definition: rbprm-steering-kinodynamic.hh:35
core::PathPtr_t operator()(const core::NodePtr_t x, core::ConfigurationIn_t q2)
Definition: rbprm-steering-kinodynamic.hh:46
int dirValid_
Definition: rbprm-steering-kinodynamic.hh:82
HPP_PREDEF_CLASS(RbPrmFullBody)
int dirTotal_
Definition: rbprm-steering-kinodynamic.hh:83
static SteeringMethodKinodynamicPtr_t create(core::ProblemConstPtr_t problem)
Create an instance.
Definition: rbprm-steering-kinodynamic.hh:55
double totalTimeValidated_
Definition: rbprm-steering-kinodynamic.hh:81
core::PathPtr_t operator()(core::ConfigurationIn_t q1, const core::NodePtr_t x)
Definition: rbprm-steering-kinodynamic.hh:37
int rejectedPath_
Definition: rbprm-steering-kinodynamic.hh:84
static SteeringMethodKinodynamicPtr_t createCopy(const SteeringMethodKinodynamicPtr_t &other)
Copy instance and return shared pointer.
Definition: rbprm-steering-kinodynamic.hh:63
const double maxLength_
Definition: rbprm-steering-kinodynamic.hh:85
void init(SteeringMethodKinodynamicWkPtr_t weak)
Store weak pointer to itself.
Definition: rbprm-steering-kinodynamic.hh:95