hpp-manipulation  4.15.1
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 
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // 1. Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // 2. Redistributions in binary form must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in the
14 // documentation and/or other materials provided with the distribution.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27 // DAMAGE.
28 
29 #ifndef HPP_MANIPULATION_PATH_PLANNER_END_EFFECTOR_TRAJECTORY_HH
30 #define HPP_MANIPULATION_PATH_PLANNER_END_EFFECTOR_TRAJECTORY_HH
31 
32 #include <hpp/core/path-planner.hh>
34 #include <hpp/manipulation/fwd.hh>
35 #include <hpp/pinocchio/frame.hh>
36 #include <pinocchio/spatial/se3.hpp>
37 
38 namespace hpp {
39 namespace manipulation {
40 namespace pathPlanner {
42  public:
43  typedef std::vector<Configuration_t> Configurations_t;
44 
45  Configurations_t solve(vectorIn_t target) { return impl_solve(target); }
46 
47  protected:
48  virtual Configurations_t impl_solve(vectorIn_t target) = 0;
49 };
50 typedef shared_ptr<IkSolverInitialization> IkSolverInitializationPtr_t;
51 
53 typedef shared_ptr<EndEffectorTrajectory> EndEffectorTrajectoryPtr_t;
54 
55 class HPP_MANIPULATION_DLLAPI EndEffectorTrajectory : public core::PathPlanner {
56  public:
60  const core::ProblemConstPtr_t& problem);
65  const core::ProblemConstPtr_t& problem,
66  const core::RoadmapPtr_t& roadmap);
67 
71  virtual void startSolve();
72 
74  virtual void oneStep();
75 
78  int nRandomConfig() const { return nRandomConfig_; }
79 
80  void nRandomConfig(int n) {
81  assert(n >= 0);
82  nRandomConfig_ = n;
83  }
84 
86  int nDiscreteSteps() const { return nDiscreteSteps_; }
87 
88  void nDiscreteSteps(int n) {
89  assert(n > 0);
90  nDiscreteSteps_ = n;
91  }
92 
95  void checkFeasibilityOnly(bool enable);
96 
97  bool checkFeasibilityOnly() const { return feasibilityOnly_; }
98 
100  ikSolverInit_ = solver;
101  }
102 
104 
105  protected:
113  const core::RoadmapPtr_t& roadmap);
115  void init(const EndEffectorTrajectoryWkPtr_t& weak);
116 
117  private:
118  std::vector<core::Configuration_t> configurations(
119  const core::Configuration_t& q_init);
120 
122  EndEffectorTrajectoryWkPtr_t weak_;
124  int nRandomConfig_;
126  int nDiscreteSteps_;
128  IkSolverInitializationPtr_t ikSolverInit_;
130  bool feasibilityOnly_;
131 }; // class EndEffectorTrajectory
132 } // namespace pathPlanner
133 } // namespace manipulation
134 } // namespace hpp
135 
136 #endif // HPP_MANIPULATION_PATH_PLANNER_END_EFFECTOR_TRAJECTORY_HH
Definition: end-effector-trajectory.hh:55
void nDiscreteSteps(int n)
Definition: end-effector-trajectory.hh:88
void ikSolverInitialization(IkSolverInitializationPtr_t solver)
Definition: end-effector-trajectory.hh:99
void init(const EndEffectorTrajectoryWkPtr_t &weak)
Store weak pointer to itself.
static EndEffectorTrajectoryPtr_t createWithRoadmap(const core::ProblemConstPtr_t &problem, const core::RoadmapPtr_t &roadmap)
EndEffectorTrajectory(const core::ProblemConstPtr_t &problem, const core::RoadmapPtr_t &roadmap)
bool checkFeasibilityOnly() const
Definition: end-effector-trajectory.hh:97
int nRandomConfig() const
Definition: end-effector-trajectory.hh:78
int nDiscreteSteps() const
Number of steps to generate goal config (successive projections).
Definition: end-effector-trajectory.hh:86
EndEffectorTrajectory(const core::ProblemConstPtr_t &problem)
static EndEffectorTrajectoryPtr_t create(const core::ProblemConstPtr_t &problem)
virtual void oneStep()
One step of the algorithm.
void nRandomConfig(int n)
Definition: end-effector-trajectory.hh:80
Definition: end-effector-trajectory.hh:41
virtual Configurations_t impl_solve(vectorIn_t target)=0
Configurations_t solve(vectorIn_t target)
Definition: end-effector-trajectory.hh:45
std::vector< Configuration_t > Configurations_t
Definition: end-effector-trajectory.hh:43
#define HPP_MANIPULATION_DLLAPI
Definition: config.hh:64
HPP_PREDEF_CLASS(EndEffectorTrajectory)
shared_ptr< EndEffectorTrajectory > EndEffectorTrajectoryPtr_t
Definition: end-effector-trajectory.hh:53
shared_ptr< IkSolverInitialization > IkSolverInitializationPtr_t
Definition: end-effector-trajectory.hh:50
shared_ptr< Roadmap > RoadmapPtr_t
Definition: fwd.hh:69
pinocchio::Configuration_t Configuration_t
Definition: fwd.hh:48
shared_ptr< const Problem > ProblemConstPtr_t
Definition: fwd.hh:67
core::vectorIn_t vectorIn_t
Definition: fwd.hh:94
Definition: main.hh:1