hpp-manipulation  4.15.1
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 
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_GRAPH_STATE_SELECTOR_HH
30 #define HPP_MANIPULATION_GRAPH_STATE_SELECTOR_HH
31 
33 #include "hpp/manipulation/fwd.hh"
36 
37 namespace hpp {
38 namespace manipulation {
39 namespace graph {
43  public:
44  virtual ~StateSelector(){};
45 
47  static StateSelectorPtr_t create(const std::string& name);
48 
49  const std::string& name() const { return name_; }
50 
52  StatePtr_t createState(const std::string& name, bool waypoint = false,
53  const int w = 0);
54 
56  StatePtr_t getState(ConfigurationIn_t config) const;
57 
59  StatePtr_t getState(RoadmapNodePtr_t node) const;
60 
62  States_t getStates() const;
63 
65  States_t getWaypointStates() const;
66 
68  virtual EdgePtr_t chooseEdge(RoadmapNodePtr_t from) const;
69 
71  virtual std::ostream& dotPrint(
72  std::ostream& os,
74 
76  void parentGraph(const GraphWkPtr_t& parent);
77 
79  GraphPtr_t parentGraph() const;
80 
81  protected:
83  void init(const StateSelectorPtr_t& weak);
84 
86  StateSelector(const std::string& name) : name_(name) {}
87 
89  virtual std::ostream& print(std::ostream& os) const;
90 
92  typedef std::pair<int, StatePtr_t> WeighedState_t;
93  typedef std::list<WeighedState_t> WeighedStates_t;
94  WeighedStates_t orderedStates_;
96 
97  private:
99  std::string name_;
101  GraphWkPtr_t graph_;
103  StateSelectorPtr_t wkPtr_;
104 
105  friend std::ostream& operator<<(std::ostream& os, const StateSelector& ss);
106 }; // Class StateSelector
107 
108 inline std::ostream& operator<<(std::ostream& os, const StateSelector& ss) {
109  return ss.print(os);
110 }
111 } // namespace graph
112 } // namespace manipulation
113 } // namespace hpp
114 
115 #endif // HPP_MANIPULATION_GRAPH_STATE_SELECTOR_HH
Definition: state-selector.hh:42
shared_ptr< StateSelector > StateSelectorPtr_t
Definition: fwd.hh:52
Definition: main.hh:1
States_t waypoints_
Definition: state-selector.hh:95
std::list< WeighedState_t > WeighedStates_t
Definition: state-selector.hh:93
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:49
#define HPP_MANIPULATION_DLLAPI
Definition: config.hh:64
virtual std::ostream & print(std::ostream &os) const
Print the object in a stream.
std::vector< StatePtr_t > States_t
Definition: fwd.hh:56
std::ostream & operator<<(std::ostream &os, const GraphComponent &graphComp)
std::pair< int, StatePtr_t > WeighedState_t
List of the states of one end-effector, ordered by priority.
Definition: state-selector.hh:92
shared_ptr< Graph > GraphPtr_t
Definition: fwd.hh:47
shared_ptr< Edge > EdgePtr_t
Definition: fwd.hh:49
WeighedStates_t orderedStates_
Definition: state-selector.hh:94
const std::string & name() const
Definition: state-selector.hh:49
shared_ptr< State > StatePtr_t
Definition: fwd.hh:48
Definition: roadmap-node.hh:42
StateSelector(const std::string &name)
Constructor.
Definition: state-selector.hh:86
virtual ~StateSelector()
Definition: state-selector.hh:44