hpp-manipulation  4.9.0
Classes for manipulation planning.
end-effector-trajectory.hh
Go to the documentation of this file.
1 // Copyright (c) 2019 CNRS
2 // Authors: Joseph Mirabel
3 //
4 // This file is part of hpp-manipulation
5 // hpp-manipulation 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-manipulation 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-manipulation If not, see
16 // <http://www.gnu.org/licenses/>.
17 
18 
19 #ifndef HPP_MANIPULATION_PATH_PLANNER_END_EFFECTOR_TRAJECTORY_HH
20 # define HPP_MANIPULATION_PATH_PLANNER_END_EFFECTOR_TRAJECTORY_HH
21 
22 # include <hpp/manipulation/config.hh>
23 # include <hpp/manipulation/fwd.hh>
24 
25 # include <pinocchio/spatial/se3.hpp>
26 
27 # include <hpp/pinocchio/frame.hh>
28 # include <hpp/core/path-planner.hh>
29 
30 namespace hpp {
31  namespace manipulation {
32  namespace pathPlanner {
33  class HPP_MANIPULATION_DLLAPI IkSolverInitialization
34  {
35  public:
36  typedef std::vector<Configuration_t> Configurations_t;
37 
38  Configurations_t solve (vectorIn_t target)
39  {
40  return impl_solve (target);
41  }
42 
43  protected:
44  virtual Configurations_t impl_solve (vectorIn_t target) = 0;
45  };
46  typedef boost::shared_ptr<IkSolverInitialization> IkSolverInitializationPtr_t;
47 
49  typedef boost::shared_ptr<EndEffectorTrajectory> EndEffectorTrajectoryPtr_t;
50 
51  class HPP_MANIPULATION_DLLAPI EndEffectorTrajectory : public core::PathPlanner
52  {
53  public:
56  static EndEffectorTrajectoryPtr_t create (const core::Problem& problem);
60  static EndEffectorTrajectoryPtr_t createWithRoadmap
61  (const core::Problem& problem, const core::RoadmapPtr_t& roadmap);
62 
66  virtual void startSolve ();
67 
69  virtual void oneStep ();
70 
73  int nRandomConfig () const
74  { return nRandomConfig_; }
75 
76  void nRandomConfig (int n)
77  {
78  assert (n >= 0);
79  nRandomConfig_ = n;
80  }
81 
83  int nDiscreteSteps () const
84  { return nDiscreteSteps_; }
85 
86  void nDiscreteSteps (int n)
87  {
88  assert (n > 0);
89  nDiscreteSteps_ = n;
90  }
91 
94  void checkFeasibilityOnly (bool enable);
95 
96  bool checkFeasibilityOnly () const
97  {
98  return feasibilityOnly_;
99  }
100 
101  void ikSolverInitialization (IkSolverInitializationPtr_t solver)
102  {
103  ikSolverInit_ = solver;
104  }
105 
106  void tryConnectInitAndGoals ();
107 
108  protected:
111  EndEffectorTrajectory (const core::Problem& problem);
115  EndEffectorTrajectory (const core::Problem& problem, const core::RoadmapPtr_t& roadmap);
117  void init (const EndEffectorTrajectoryWkPtr_t& weak);
118 
119  private:
120  std::vector<core::Configuration_t> configurations(const core::Configuration_t& q_init);
121 
123  EndEffectorTrajectoryWkPtr_t weak_;
125  int nRandomConfig_;
127  int nDiscreteSteps_;
129  IkSolverInitializationPtr_t ikSolverInit_;
131  bool feasibilityOnly_;
132  }; // class EndEffectorTrajectory
133  } // namespace pathPlanner
134  } // namespace manipulation
135 } // namespace hpp
136 
137 #endif // HPP_MANIPULATION_PATH_PLANNER_END_EFFECTOR_TRAJECTORY_HH
Vec3f n
boost::shared_ptr< IkSolverInitialization > IkSolverInitializationPtr_t
Definition: end-effector-trajectory.hh:46
core::vectorIn_t vectorIn_t
Definition: fwd.hh:83
boost::shared_ptr< EndEffectorTrajectory > EndEffectorTrajectoryPtr_t
Definition: end-effector-trajectory.hh:49
Definition: end-effector-trajectory.hh:51
Configurations_t solve(vectorIn_t target)
Definition: end-effector-trajectory.hh:38
assert(d.lhs()._blocks()==d.rhs()._blocks())
void nDiscreteSteps(int n)
Definition: end-effector-trajectory.hh:86
int nDiscreteSteps() const
Number of steps to generate goal config (successive projections).
Definition: end-effector-trajectory.hh:83
void init(const ConfigurationShooterWkPtr_t &weak)
Definition: end-effector-trajectory.hh:33
const Problem & problem() const
int nRandomConfig() const
Definition: end-effector-trajectory.hh:73
static GradientBasedPtr_t create(const Problem &problem)
bool checkFeasibilityOnly() const
Definition: end-effector-trajectory.hh:96
HPP_PREDEF_CLASS(EndEffectorTrajectory)
boost::shared_ptr< Roadmap > RoadmapPtr_t
void nRandomConfig(int n)
Definition: end-effector-trajectory.hh:76
std::vector< Configuration_t > Configurations_t
Definition: end-effector-trajectory.hh:36
void ikSolverInitialization(IkSolverInitializationPtr_t solver)
Definition: end-effector-trajectory.hh:101
pinocchio::Configuration_t Configuration_t