hpp-manipulation 6.0.0
Classes for manipulation planning.
Loading...
Searching...
No Matches
leaf-connected-comp.hh
Go to the documentation of this file.
1//
2// Copyright (c) 2016 CNRS
3// Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
4//
5
6// Redistribution and use in source and binary forms, with or without
7// modification, are permitted provided that the following conditions are
8// met:
9//
10// 1. Redistributions of source code must retain the above copyright
11// notice, this list of conditions and the following disclaimer.
12//
13// 2. Redistributions in binary form must reproduce the above copyright
14// notice, this list of conditions and the following disclaimer in the
15// documentation and/or other materials provided with the distribution.
16//
17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
28// DAMAGE.
29
30#ifndef HPP_MANIPULATION_LEAF_CONNECTED_COMP_HH
31#define HPP_MANIPULATION_LEAF_CONNECTED_COMP_HH
32
37
38namespace hpp {
39namespace manipulation {
45 public:
47 typedef std::set<RawPtr_t> LeafConnectedComps_t;
50
54 virtual void merge(const LeafConnectedCompPtr_t& otherCC);
55
59
66
69 void addNode(const RoadmapNodePtr_t& node);
70
71 virtual void setFirstNode(const RoadmapNodePtr_t& node);
72
73 core::ConnectedComponentPtr_t connectedComponent() const {
74 assert(!nodes_.empty());
75 return nodes_.front()->connectedComponent();
76 };
77
78 const RoadmapNodes_t& nodes() const { return nodes_; }
79
80 LeafConnectedCompPtr_t self() { return weak_.lock(); }
81
82 const LeafConnectedComp::LeafConnectedComps_t& from() const { return from_; }
83
84 const LeafConnectedComp::LeafConnectedComps_t& to() const { return to_; }
85
86 protected:
87 LeafConnectedComp(const RoadmapPtr_t& r) : roadmap_(r) {}
88
89 void init(const LeafConnectedCompWkPtr_t& shPtr) { weak_ = shPtr; }
90
93
96
97 private:
98 static void clean(LeafConnectedComps_t& set);
99 // status variable to indicate whether or not CC has been visited
100 mutable bool explored_;
101 RoadmapWkPtr_t roadmap_;
102 LeafConnectedComps_t to_, from_;
103 LeafConnectedCompWkPtr_t weak_;
104 friend class Roadmap;
105
106 HPP_SERIALIZABLE();
107}; // class LeafConnectedComp
108
110 : public LeafConnectedComp {
111 public:
112 void merge(const LeafConnectedCompPtr_t& otherCC);
113
115
117
118 std::size_t indexOf(const graph::EdgePtr_t e) const;
119
121 const value_type s = p_.sum();
122 p_ /= s;
123 }
124
128 std::vector<graph::EdgePtr_t> edges_;
129
130 protected:
132 : LeafConnectedComp(r), weight_(1) {}
133
134 private:
136 HPP_SERIALIZABLE();
137}; // class LeafConnectedComp
138} // namespace manipulation
139} // namespace hpp
140#endif // HPP_MANIPULATION_LEAF_CONNECTED_COMP_HH
Definition leaf-connected-comp.hh:44
virtual void setFirstNode(const RoadmapNodePtr_t &node)
RoadmapNodes_t nodes_
Definition leaf-connected-comp.hh:92
LeafConnectedComp()
For serialization only.
Definition leaf-connected-comp.hh:95
void init(const LeafConnectedCompWkPtr_t &shPtr)
Definition leaf-connected-comp.hh:89
const LeafConnectedComp::LeafConnectedComps_t & to() const
Definition leaf-connected-comp.hh:84
LeafConnectedCompPtr_t self()
Definition leaf-connected-comp.hh:80
LeafConnectedComp(const RoadmapPtr_t &r)
Definition leaf-connected-comp.hh:87
bool canReach(const LeafConnectedCompPtr_t &cc)
std::set< RawPtr_t > LeafConnectedComps_t
Definition leaf-connected-comp.hh:47
LeafConnectedComp * RawPtr_t
Definition leaf-connected-comp.hh:46
void addNode(const RoadmapNodePtr_t &node)
static LeafConnectedCompPtr_t create(const RoadmapPtr_t &roadmap)
return a shared pointer to new instance
graph::StatePtr_t state_
Definition leaf-connected-comp.hh:91
bool canReach(const LeafConnectedCompPtr_t &cc, LeafConnectedComp::LeafConnectedComps_t &cc2Tocc1)
virtual void merge(const LeafConnectedCompPtr_t &otherCC)
const LeafConnectedComp::LeafConnectedComps_t & from() const
Definition leaf-connected-comp.hh:82
core::ConnectedComponentPtr_t connectedComponent() const
Definition leaf-connected-comp.hh:73
const RoadmapNodes_t & nodes() const
Definition leaf-connected-comp.hh:78
Definition roadmap-node.hh:42
Definition roadmap.hh:47
Definition leaf-connected-comp.hh:110
static WeighedLeafConnectedCompPtr_t create(const RoadmapPtr_t &roadmap)
void setFirstNode(const RoadmapNodePtr_t &node)
std::vector< graph::EdgePtr_t > edges_
Definition leaf-connected-comp.hh:128
WeighedLeafConnectedComp(const RoadmapPtr_t &r)
Definition leaf-connected-comp.hh:131
vector_t p_
Transition probabilities.
Definition leaf-connected-comp.hh:127
void normalizeProba()
Definition leaf-connected-comp.hh:120
void merge(const LeafConnectedCompPtr_t &otherCC)
std::size_t indexOf(const graph::EdgePtr_t e) const
value_type weight_
Definition leaf-connected-comp.hh:125
#define HPP_MANIPULATION_DLLAPI
Definition config.hh:88
shared_ptr< Edge > EdgePtr_t
Definition fwd.hh:49
shared_ptr< State > StatePtr_t
Definition fwd.hh:48
shared_ptr< Roadmap > RoadmapPtr_t
Definition fwd.hh:68
shared_ptr< WeighedLeafConnectedComp > WeighedLeafConnectedCompPtr_t
Definition fwd.hh:79
shared_ptr< LeafConnectedComp > LeafConnectedCompPtr_t
Definition fwd.hh:75
core::value_type value_type
Definition fwd.hh:89
std::set< LeafConnectedCompPtr_t > LeafConnectedComps_t
Definition fwd.hh:77
core::vector_t vector_t
Definition fwd.hh:92
std::vector< RoadmapNodePtr_t > RoadmapNodes_t
Definition fwd.hh:71
Definition main.hh:1