hpp-manipulation  6.0.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 
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 
57 
60 
63 
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 
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;
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: roadmap-node.hh:42
Definition: state-selector.hh:42
StatePtr_t getState(ConfigurationIn_t config) const
Returns the state of a configuration.
virtual std::ostream & print(std::ostream &os) const
Print the object in a stream.
virtual std::ostream & dotPrint(std::ostream &os, dot::DrawingAttributes da=dot::DrawingAttributes()) const
Print the object in a stream.
virtual ~StateSelector()
Definition: state-selector.hh:44
void parentGraph(const GraphWkPtr_t &parent)
Set the parent graph.
StateSelector(const std::string &name)
Constructor.
Definition: state-selector.hh:86
std::pair< int, StatePtr_t > WeighedState_t
List of the states of one end-effector, ordered by priority.
Definition: state-selector.hh:92
States_t getStates() const
Returns a list of all the states.
void init(const StateSelectorPtr_t &weak)
Initialization of the object.
States_t waypoints_
Definition: state-selector.hh:95
virtual EdgePtr_t chooseEdge(RoadmapNodePtr_t from) const
Select randomly an outgoing edge of the given state.
StatePtr_t getState(RoadmapNodePtr_t node) const
Returns the state of a roadmap state.
WeighedStates_t orderedStates_
Definition: state-selector.hh:94
States_t getWaypointStates() const
Returns a list of all the states.
static StateSelectorPtr_t create(const std::string &name)
Create a new StateSelector.
StatePtr_t createState(const std::string &name, bool waypoint=false, const int w=0)
Create an empty state.
GraphPtr_t parentGraph() const
Set the parent graph.
std::list< WeighedState_t > WeighedStates_t
Definition: state-selector.hh:93
const std::string & name() const
Definition: state-selector.hh:49
#define HPP_MANIPULATION_DLLAPI
Definition: config.hh:88
std::ostream & operator<<(std::ostream &os, const GraphComponent &graphComp)
shared_ptr< Edge > EdgePtr_t
Definition: fwd.hh:49
shared_ptr< State > StatePtr_t
Definition: fwd.hh:48
shared_ptr< StateSelector > StateSelectorPtr_t
Definition: fwd.hh:52
std::vector< StatePtr_t > States_t
Definition: fwd.hh:56
shared_ptr< Graph > GraphPtr_t
Definition: fwd.hh:47
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:49
Definition: main.hh:1