hpp-manipulation  4.9.0
Classes for manipulation planning.
graph-path-validation.hh
Go to the documentation of this file.
1 // Copyright (c) 2014, LAAS-CNRS
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
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 <http://www.gnu.org/licenses/>.
16 
17 
18 #ifndef HPP_MANIPULATION_GRAPHPATHVALIDATOR_HH
19 # define HPP_MANIPULATION_GRAPHPATHVALIDATOR_HH
20 
21 # include <hpp/core/path-validation.hh>
22 # include <hpp/core/obstacle-user.hh>
23 
24 # include <hpp/manipulation/fwd.hh>
25 # include <hpp/manipulation/config.hh>
27 
28 namespace hpp {
29  namespace manipulation {
32  using hpp::core::Path;
36 
39 
46  class HPP_MANIPULATION_DLLAPI GraphPathValidation :
47  public PathValidation,
49  {
50  public:
62  virtual bool validate (const PathPtr_t& path, bool reverse,
63  PathPtr_t& validPart,
65 
67  void innerValidation (const PathValidationPtr_t& pathValidation)
68  {
69  pathValidation_ = pathValidation;
70  }
71 
74  {
75  return pathValidation_;
76  }
77 
79  void constraintGraph (const graph::GraphPtr_t& graph)
80  {
81  constraintGraph_ = graph;
82  }
83 
86  {
87  return constraintGraph_;
88  }
89 
92  // checking.
93  // \param graph A pointer to the constraint graph.
95  const PathValidationPtr_t& pathValidation);
96 
97  template <typename T>
99  const pinocchio::DevicePtr_t& robot, const value_type& stepSize);
100 
107  {
108  boost::shared_ptr<core::ObstacleUserInterface> oui =
110  if (oui) oui->addObstacle (object);
111  }
112 
120  const pinocchio::CollisionObjectConstPtr_t& obstacle)
121  {
122  boost::shared_ptr<core::ObstacleUserInterface> oui =
124  if (oui) oui->removeObstacleFromJoint (joint, obstacle);
125  }
126 
134  {
135  boost::shared_ptr<core::ObstacleUserInterface> oui =
137  if (oui) oui->filterCollisionPairs (relMotion);
138  }
139 
146  void setSecurityMargins(const matrix_t& securityMargins)
147  {
148  boost::shared_ptr<core::ObstacleUserInterface> oui =
150  if (oui) oui->setSecurityMargins(securityMargins);
151  }
152 
153  protected:
155  GraphPathValidation (const PathValidationPtr_t& pathValidation);
156 
157  private:
159  bool impl_validate (const PathVectorPtr_t& path, bool reverse,
160  PathPtr_t& validPart, PathValidationReportPtr_t& report);
162  bool impl_validate (const PathPtr_t& path, bool reverse,
163  PathPtr_t& validPart, PathValidationReportPtr_t& report);
165  PathValidationPtr_t pathValidation_;
167  graph::GraphPtr_t constraintGraph_;
168  };
169 
170  template <typename T>
172  (const pinocchio::DevicePtr_t& robot, const value_type& stepSize)
173  {
174  return GraphPathValidation::create (T::create (robot, stepSize));
175  }
177  } // namespace manipulation
178 } // namespace hpp
179 
180 #endif // HPP_MANIPULATION_GRAPHPATHVALIDATOR_HH
boost::shared_ptr< Path > PathPtr_t
boost::shared_ptr< Device > DevicePtr_t
Definition: graph-path-validation.hh:46
static GraphPathValidationPtr_t create(const PathValidationPtr_t &pathValidation)
core::PathValidationReportPtr_t PathValidationReportPtr_t
Definition: fwd.hh:119
void constraintGraph(const graph::GraphPtr_t &graph)
Set the graph of constraints.
Definition: graph-path-validation.hh:79
pinocchio::JointPtr_t JointPtr_t
Definition: fwd.hh:32
#define HPP_DYNAMIC_PTR_CAST(t, x)
core::value_type value_type
Definition: fwd.hh:79
void addObstacle(const hpp::core::CollisionObjectConstPtr_t &object)
Definition: graph-path-validation.hh:106
graph::GraphPtr_t constraintGraph() const
Get the graph of constraints.
Definition: graph-path-validation.hh:85
boost::shared_ptr< GraphPathValidation > GraphPathValidationPtr_t
Definition: fwd.hh:88
void setSecurityMargins(const matrix_t &securityMargins)
Definition: graph-path-validation.hh:146
boost::shared_ptr< PathValidation > PathValidationPtr_t
void innerValidation(const PathValidationPtr_t &pathValidation)
Set the encapsulated path validator.
Definition: graph-path-validation.hh:67
core::matrix_t matrix_t
Definition: fwd.hh:120
core::PathValidationPtr_t PathValidationPtr_t
Definition: fwd.hh:118
static GradientBasedPtr_t create(const Problem &problem)
boost::shared_ptr< PathVector > PathVectorPtr_t
void filterCollisionPairs(const core::RelativeMotion::matrix_type &relMotion)
Filter collision pairs.
Definition: graph-path-validation.hh:133
boost::shared_ptr< Graph > GraphPtr_t
Definition: fwd.hh:35
void removeObstacleFromJoint(const JointPtr_t &joint, const pinocchio::CollisionObjectConstPtr_t &obstacle)
Definition: graph-path-validation.hh:119
const PathValidationPtr_t & innerValidation()
Get the encapsulated path validator.
Definition: graph-path-validation.hh:73
boost::shared_ptr< const CollisionObject > CollisionObjectConstPtr_t
Eigen::Matrix< RelativeMotionType, Eigen::Dynamic, Eigen::Dynamic > matrix_type
pinocchio::CollisionObjectConstPtr_t CollisionObjectConstPtr_t