hpp-manipulation  6.0.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 
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 
57 
95 class HPP_MANIPULATION_DLLAPI EndEffectorTrajectory : public core::PathPlanner {
96  public:
100  const core::ProblemConstPtr_t& problem);
105  const core::ProblemConstPtr_t& problem,
106  const core::RoadmapPtr_t& roadmap);
107 
111  virtual void startSolve();
112 
114  virtual void oneStep();
115 
118  int nRandomConfig() const { return nRandomConfig_; }
119 
120  void nRandomConfig(int n) {
121  assert(n >= 0);
122  nRandomConfig_ = n;
123  }
124 
126  int nDiscreteSteps() const { return nDiscreteSteps_; }
127 
128  void nDiscreteSteps(int n) {
129  assert(n > 0);
130  nDiscreteSteps_ = n;
131  }
132 
135  void checkFeasibilityOnly(bool enable);
136 
137  bool checkFeasibilityOnly() const { return feasibilityOnly_; }
138 
140  ikSolverInit_ = solver;
141  }
142 
144 
145  protected:
153  const core::RoadmapPtr_t& roadmap);
155  void init(const EndEffectorTrajectoryWkPtr_t& weak);
156 
157  private:
158  std::vector<core::Configuration_t> configurations(
159  const core::Configuration_t& q_init);
160 
162  EndEffectorTrajectoryWkPtr_t weak_;
164  int nRandomConfig_;
166  int nDiscreteSteps_;
168  IkSolverInitializationPtr_t ikSolverInit_;
170  bool feasibilityOnly_;
171 }; // class EndEffectorTrajectory
172 // \}
173 } // namespace pathPlanner
174 } // namespace manipulation
175 } // namespace hpp
176 
177 #endif // HPP_MANIPULATION_PATH_PLANNER_END_EFFECTOR_TRAJECTORY_HH
Definition: end-effector-trajectory.hh:95
Definition: end-effector-trajectory.hh:41
#define HPP_MANIPULATION_DLLAPI
Definition: config.hh:88
void nDiscreteSteps(int n)
Definition: end-effector-trajectory.hh:128
void ikSolverInitialization(IkSolverInitializationPtr_t solver)
Definition: end-effector-trajectory.hh:139
virtual Configurations_t impl_solve(vectorIn_t target)=0
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)
Configurations_t solve(vectorIn_t target)
Definition: end-effector-trajectory.hh:45
EndEffectorTrajectory(const core::ProblemConstPtr_t &problem, const core::RoadmapPtr_t &roadmap)
bool checkFeasibilityOnly() const
Definition: end-effector-trajectory.hh:137
std::vector< Configuration_t > Configurations_t
Definition: end-effector-trajectory.hh:43
int nRandomConfig() const
Definition: end-effector-trajectory.hh:118
int nDiscreteSteps() const
Number of steps to generate goal config (successive projections).
Definition: end-effector-trajectory.hh:126
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:120
shared_ptr< EndEffectorTrajectory > EndEffectorTrajectoryPtr_t
Definition: fwd.hh:99
HPP_PREDEF_CLASS(EndEffectorTrajectory)
shared_ptr< IkSolverInitialization > IkSolverInitializationPtr_t
Definition: end-effector-trajectory.hh:50
shared_ptr< Roadmap > RoadmapPtr_t
Definition: fwd.hh:68
pinocchio::Configuration_t Configuration_t
Definition: fwd.hh:48
shared_ptr< const Problem > ProblemConstPtr_t
Definition: fwd.hh:66
core::vectorIn_t vectorIn_t
Definition: fwd.hh:93
Definition: main.hh:1