hpp-manipulation  4.9.0
Classes for manipulation planning.
state-selector.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_STATE_SELECTOR_HH
18 # define HPP_MANIPULATION_GRAPH_STATE_SELECTOR_HH
19 
20 #include "hpp/manipulation/config.hh"
21 #include "hpp/manipulation/fwd.hh"
24 
25 namespace hpp {
26  namespace manipulation {
27  namespace graph {
30  class HPP_MANIPULATION_DLLAPI StateSelector
31  {
32  public:
33  virtual ~StateSelector () {};
34 
36  static StateSelectorPtr_t create(const std::string& name);
37 
38  const std::string& name() const
39  {
40  return name_;
41  }
42 
44  StatePtr_t createState (const std::string& name, bool waypoint = false,
45  const int w = 0);
46 
48  StatePtr_t getState(ConfigurationIn_t config) const;
49 
51  StatePtr_t getState(RoadmapNodePtr_t node) const;
52 
54  States_t getStates () const;
55 
57  States_t getWaypointStates () const;
58 
60  virtual EdgePtr_t chooseEdge(RoadmapNodePtr_t from) const;
61 
63  virtual std::ostream& dotPrint (std::ostream& os, dot::DrawingAttributes da = dot::DrawingAttributes ()) const;
64 
66  void parentGraph(const GraphWkPtr_t& parent);
67 
69  GraphPtr_t parentGraph() const;
70 
71  protected:
73  void init (const StateSelectorPtr_t& weak);
74 
76  StateSelector (const std::string& name) : name_ (name)
77  {}
78 
80  virtual std::ostream& print (std::ostream& os) const;
81 
83  typedef std::pair <int, StatePtr_t> WeighedState_t;
84  typedef std::list <WeighedState_t> WeighedStates_t;
85  WeighedStates_t orderedStates_;
87 
88  private:
90  std::string name_;
92  GraphWkPtr_t graph_;
94  StateSelectorPtr_t wkPtr_;
95 
96  friend std::ostream& operator<< (std::ostream& os, const StateSelector& ss);
97  }; // Class StateSelector
98 
99  inline std::ostream& operator<< (std::ostream& os, const StateSelector& ss)
100  {
101  return ss.print(os);
102  }
103  } // namespace graph
104  } // namespace manipulation
105 } // namespace hpp
106 
107 #endif // HPP_MANIPULATION_GRAPH_STATE_SELECTOR_HH
Definition: state-selector.hh:30
States_t waypoints_
Definition: state-selector.hh:86
boost::shared_ptr< StateSelector > StateSelectorPtr_t
Definition: fwd.hh:40
std::list< WeighedState_t > WeighedStates_t
Definition: state-selector.hh:84
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:38
boost::shared_ptr< State > StatePtr_t
Definition: fwd.hh:36
virtual std::ostream & print(std::ostream &os) const
Print the object in a stream.
std::ostream & operator<<(std::ostream &os, const GraphComponent &graphComp)
void init(const ConfigurationShooterWkPtr_t &weak)
std::pair< int, StatePtr_t > WeighedState_t
List of the states of one end-effector, ordered by priority.
Definition: state-selector.hh:83
static GradientBasedPtr_t create(const Problem &problem)
boost::shared_ptr< Edge > EdgePtr_t
Definition: fwd.hh:37
boost::shared_ptr< Graph > GraphPtr_t
Definition: fwd.hh:35
WeighedStates_t orderedStates_
Definition: state-selector.hh:85
std::vector< StatePtr_t > States_t
Definition: fwd.hh:45
const std::string & name() const
Definition: state-selector.hh:38
Definition: roadmap-node.hh:32
StateSelector(const std::string &name)
Constructor.
Definition: state-selector.hh:76
virtual ~StateSelector()
Definition: state-selector.hh:33