hpp-manipulation  4.9.0
Classes for manipulation planning.
graph-component.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 #ifndef HPP_MANIPULATION_GRAPH_GRAPHCOMPONENT_HH
18 # define HPP_MANIPULATION_GRAPH_GRAPHCOMPONENT_HH
19 
20 # include <string>
21 # include <ostream>
22 
23 # include "hpp/manipulation/config.hh"
24 # include "hpp/manipulation/deprecated.hh"
25 # include "hpp/manipulation/fwd.hh"
28 
29 namespace hpp {
30  namespace manipulation {
32  namespace graph {
34 
37 
39  class HPP_MANIPULATION_DLLAPI GraphComponent
40  {
41  public:
42  virtual ~GraphComponent () {};
43 
45  const std::string& name() const;
46 
48  const std::size_t& id () const
49  {
50  return id_;
51  }
52 
55  // for more information.
56  virtual void addNumericalConstraint (
57  const ImplicitPtr_t& numConstraint,
58  const segments_t& passiveDofs = segments_t ());
59 
61  virtual void addNumericalCost (const ImplicitPtr_t& numCost);
62 
64  virtual void resetNumericalConstraints ();
65 
69  virtual void addLockedJointConstraint
71 
75  virtual void resetLockedJoints () HPP_MANIPULATION_DEPRECATED;
76 
79  bool insertNumericalConstraints (ConfigProjectorPtr_t& proj) const;
80 
85  bool insertLockedJoints (ConfigProjectorPtr_t& cs) const
87 
89  const NumericalConstraints_t& numericalConstraints() const;
90 
92  const NumericalConstraints_t& numericalCosts() const;
93 
95  const IntervalsContainer_t& passiveDofs() const;
96 
100  const LockedJoints_t& lockedJoints () const
102 
104  void parentGraph(const GraphWkPtr_t& parent);
105 
107  GraphPtr_t parentGraph() const;
108 
110  virtual std::ostream& dotPrint (std::ostream& os, dot::DrawingAttributes da = dot::DrawingAttributes ()) const;
111 
113  void setDirty();
114 
115  protected:
117  void init (const GraphComponentWkPtr_t& weak);
118 
119  GraphComponent(const std::string& name) : isInit_(false)
120  , name_ (name)
121  , id_(-1)
122  {}
123 
133  GraphWkPtr_t graph_;
134 
135  bool isInit_;
136 
137  void throwIfNotInitialized () const;
138 
140  virtual std::ostream& print (std::ostream& os) const;
141  friend std::ostream& operator<< (std::ostream&, const GraphComponent&);
142 
144  virtual void populateTooltip (dot::Tooltip& tp) const;
145 
146  virtual void initialize () = 0;
147 
148  private:
150  std::string name_;
152  GraphComponentWkPtr_t wkPtr_;
154  std::size_t id_;
155 
156  friend class Graph;
157  };
158 
159  std::ostream& operator<< (std::ostream& os, const GraphComponent& graphComp);
160 
162  } // namespace graph
163  } // namespace manipulation
164 
165 } // namespace hpp
166 
167 #endif // HPP_MANIPULATION_GRAPH_GRAPHCOMPONENT_HH
StateHistogram NodeHistogram HPP_MANIPULATION_DEPRECATED
Definition: statistics.hh:200
NumericalConstraints_t numericalCosts_
Stores the numerical costs.
Definition: graph-component.hh:129
GraphWkPtr_t graph_
A weak pointer to the parent graph.
Definition: graph-component.hh:133
bool initialize(MeshCollisionTraversalNode< BV, RelativeTransformationIsIdentity > &node, BVHModel< BV > &model1, Transform3f &tf1, BVHModel< BV > &model2, Transform3f &tf2, CollisionResult &result, bool use_refit=false, bool refit_bottomup=false)
const std::size_t & id() const
Return the component id.
Definition: graph-component.hh:48
hpp::core::segments_t segments_t
Definition: fwd.hh:51
virtual ~GraphComponent()
Definition: graph-component.hh:42
core::ConfigProjectorPtr_t ConfigProjectorPtr_t
Definition: fwd.hh:110
std::ostream & operator<<(std::ostream &os, const GraphComponent &graphComp)
hpp::core::LockedJoints_t LockedJoints_t
Definition: fwd.hh:54
void init(const ConfigurationShooterWkPtr_t &weak)
IntervalsContainer_t passiveDofs_
Stores the passive dofs for each numerical constraints.
Definition: graph-component.hh:127
GraphComponent(const std::string &name)
Definition: graph-component.hh:119
constraints::LockedJointPtr_t LockedJointPtr_t
Definition: fwd.hh:107
constraints::ImplicitPtr_t ImplicitPtr_t
Definition: fwd.hh:105
hpp::core::NumericalConstraints_t NumericalConstraints_t
Definition: fwd.hh:53
NumericalConstraints_t numericalConstraints_
Stores the numerical constraints.
Definition: graph-component.hh:125
Define common methods of the graph components.
Definition: graph-component.hh:39
boost::shared_ptr< Graph > GraphPtr_t
Definition: fwd.hh:35
std::vector< segments_t > IntervalsContainer_t
Definition: fwd.hh:52
boost::shared_ptr< Implicit > ImplicitPtr_t
Definition: graph.hh:45
const LockedJoints_t lockedJoints_
List of LockedJoint constraints:
Definition: graph-component.hh:131
bool isInit_
Definition: graph-component.hh:135