roby 0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +29 -0
- data/History.txt +4 -0
- data/License-fr.txt +519 -0
- data/License.txt +515 -0
- data/Manifest.txt +245 -0
- data/NOTES +4 -0
- data/README.txt +163 -0
- data/Rakefile +161 -0
- data/TODO.txt +146 -0
- data/app/README.txt +24 -0
- data/app/Rakefile +8 -0
- data/app/config/ROBOT.rb +5 -0
- data/app/config/app.yml +91 -0
- data/app/config/init.rb +7 -0
- data/app/config/roby.yml +3 -0
- data/app/controllers/.gitattributes +0 -0
- data/app/controllers/ROBOT.rb +2 -0
- data/app/data/.gitattributes +0 -0
- data/app/planners/ROBOT/main.rb +6 -0
- data/app/planners/main.rb +5 -0
- data/app/scripts/distributed +3 -0
- data/app/scripts/generate/bookmarks +3 -0
- data/app/scripts/replay +3 -0
- data/app/scripts/results +3 -0
- data/app/scripts/run +3 -0
- data/app/scripts/server +3 -0
- data/app/scripts/shell +3 -0
- data/app/scripts/test +3 -0
- data/app/tasks/.gitattributes +0 -0
- data/app/tasks/ROBOT/.gitattributes +0 -0
- data/bin/roby +210 -0
- data/bin/roby-log +168 -0
- data/bin/roby-shell +25 -0
- data/doc/images/event_generalization.png +0 -0
- data/doc/images/exception_propagation_1.png +0 -0
- data/doc/images/exception_propagation_2.png +0 -0
- data/doc/images/exception_propagation_3.png +0 -0
- data/doc/images/exception_propagation_4.png +0 -0
- data/doc/images/exception_propagation_5.png +0 -0
- data/doc/images/replay_handler_error.png +0 -0
- data/doc/images/replay_handler_error_0.png +0 -0
- data/doc/images/replay_handler_error_1.png +0 -0
- data/doc/images/roby_cycle_overview.png +0 -0
- data/doc/images/roby_replay_02.png +0 -0
- data/doc/images/roby_replay_03.png +0 -0
- data/doc/images/roby_replay_04.png +0 -0
- data/doc/images/roby_replay_event_representation.png +0 -0
- data/doc/images/roby_replay_first_state.png +0 -0
- data/doc/images/roby_replay_relations.png +0 -0
- data/doc/images/roby_replay_startup.png +0 -0
- data/doc/images/task_event_generalization.png +0 -0
- data/doc/papers.rdoc +11 -0
- data/doc/styles/allison.css +314 -0
- data/doc/styles/allison.js +316 -0
- data/doc/styles/allison.rb +276 -0
- data/doc/styles/jamis.rb +593 -0
- data/doc/tutorials/01-GettingStarted.rdoc +86 -0
- data/doc/tutorials/02-GoForward.rdoc +220 -0
- data/doc/tutorials/03-PlannedPath.rdoc +268 -0
- data/doc/tutorials/04-EventPropagation.rdoc +236 -0
- data/doc/tutorials/05-ErrorHandling.rdoc +319 -0
- data/doc/tutorials/06-Overview.rdoc +40 -0
- data/doc/videos.rdoc +69 -0
- data/ext/droby/dump.cc +175 -0
- data/ext/droby/extconf.rb +3 -0
- data/ext/graph/algorithm.cc +746 -0
- data/ext/graph/extconf.rb +7 -0
- data/ext/graph/graph.cc +529 -0
- data/ext/graph/graph.hh +183 -0
- data/ext/graph/iterator_sequence.hh +102 -0
- data/ext/graph/undirected_dfs.hh +226 -0
- data/ext/graph/undirected_graph.hh +421 -0
- data/lib/roby.rb +41 -0
- data/lib/roby/app.rb +870 -0
- data/lib/roby/app/rake.rb +56 -0
- data/lib/roby/app/run.rb +14 -0
- data/lib/roby/app/scripts/distributed.rb +13 -0
- data/lib/roby/app/scripts/generate/bookmarks.rb +162 -0
- data/lib/roby/app/scripts/replay.rb +31 -0
- data/lib/roby/app/scripts/results.rb +15 -0
- data/lib/roby/app/scripts/run.rb +26 -0
- data/lib/roby/app/scripts/server.rb +18 -0
- data/lib/roby/app/scripts/shell.rb +88 -0
- data/lib/roby/app/scripts/test.rb +40 -0
- data/lib/roby/basic_object.rb +151 -0
- data/lib/roby/config.rb +5 -0
- data/lib/roby/control.rb +747 -0
- data/lib/roby/decision_control.rb +17 -0
- data/lib/roby/distributed.rb +32 -0
- data/lib/roby/distributed/base.rb +440 -0
- data/lib/roby/distributed/communication.rb +871 -0
- data/lib/roby/distributed/connection_space.rb +592 -0
- data/lib/roby/distributed/distributed_object.rb +206 -0
- data/lib/roby/distributed/drb.rb +62 -0
- data/lib/roby/distributed/notifications.rb +539 -0
- data/lib/roby/distributed/peer.rb +550 -0
- data/lib/roby/distributed/protocol.rb +529 -0
- data/lib/roby/distributed/proxy.rb +343 -0
- data/lib/roby/distributed/subscription.rb +311 -0
- data/lib/roby/distributed/transaction.rb +498 -0
- data/lib/roby/event.rb +897 -0
- data/lib/roby/exceptions.rb +234 -0
- data/lib/roby/executives/simple.rb +30 -0
- data/lib/roby/graph.rb +166 -0
- data/lib/roby/interface.rb +390 -0
- data/lib/roby/log.rb +3 -0
- data/lib/roby/log/chronicle.rb +303 -0
- data/lib/roby/log/console.rb +72 -0
- data/lib/roby/log/data_stream.rb +197 -0
- data/lib/roby/log/dot.rb +279 -0
- data/lib/roby/log/event_stream.rb +151 -0
- data/lib/roby/log/file.rb +340 -0
- data/lib/roby/log/gui/basic_display.ui +83 -0
- data/lib/roby/log/gui/chronicle.rb +26 -0
- data/lib/roby/log/gui/chronicle_view.rb +40 -0
- data/lib/roby/log/gui/chronicle_view.ui +70 -0
- data/lib/roby/log/gui/data_displays.rb +172 -0
- data/lib/roby/log/gui/data_displays.ui +155 -0
- data/lib/roby/log/gui/notifications.rb +26 -0
- data/lib/roby/log/gui/relations.rb +248 -0
- data/lib/roby/log/gui/relations.ui +123 -0
- data/lib/roby/log/gui/relations_view.rb +185 -0
- data/lib/roby/log/gui/relations_view.ui +149 -0
- data/lib/roby/log/gui/replay.rb +327 -0
- data/lib/roby/log/gui/replay_controls.rb +200 -0
- data/lib/roby/log/gui/replay_controls.ui +259 -0
- data/lib/roby/log/gui/runtime.rb +130 -0
- data/lib/roby/log/hooks.rb +185 -0
- data/lib/roby/log/logger.rb +202 -0
- data/lib/roby/log/notifications.rb +244 -0
- data/lib/roby/log/plan_rebuilder.rb +470 -0
- data/lib/roby/log/relations.rb +1056 -0
- data/lib/roby/log/server.rb +550 -0
- data/lib/roby/log/sqlite.rb +47 -0
- data/lib/roby/log/timings.rb +164 -0
- data/lib/roby/plan-object.rb +247 -0
- data/lib/roby/plan.rb +762 -0
- data/lib/roby/planning.rb +13 -0
- data/lib/roby/planning/loops.rb +302 -0
- data/lib/roby/planning/model.rb +906 -0
- data/lib/roby/planning/task.rb +151 -0
- data/lib/roby/propagation.rb +562 -0
- data/lib/roby/query.rb +619 -0
- data/lib/roby/relations.rb +583 -0
- data/lib/roby/relations/conflicts.rb +70 -0
- data/lib/roby/relations/ensured.rb +20 -0
- data/lib/roby/relations/error_handling.rb +23 -0
- data/lib/roby/relations/events.rb +9 -0
- data/lib/roby/relations/executed_by.rb +193 -0
- data/lib/roby/relations/hierarchy.rb +239 -0
- data/lib/roby/relations/influence.rb +10 -0
- data/lib/roby/relations/planned_by.rb +63 -0
- data/lib/roby/robot.rb +7 -0
- data/lib/roby/standard_errors.rb +218 -0
- data/lib/roby/state.rb +5 -0
- data/lib/roby/state/events.rb +221 -0
- data/lib/roby/state/information.rb +55 -0
- data/lib/roby/state/pos.rb +110 -0
- data/lib/roby/state/shapes.rb +32 -0
- data/lib/roby/state/state.rb +353 -0
- data/lib/roby/support.rb +92 -0
- data/lib/roby/task-operations.rb +182 -0
- data/lib/roby/task.rb +1618 -0
- data/lib/roby/test/common.rb +399 -0
- data/lib/roby/test/distributed.rb +214 -0
- data/lib/roby/test/tasks/empty_task.rb +9 -0
- data/lib/roby/test/tasks/goto.rb +36 -0
- data/lib/roby/test/tasks/simple_task.rb +23 -0
- data/lib/roby/test/testcase.rb +519 -0
- data/lib/roby/test/tools.rb +160 -0
- data/lib/roby/thread_task.rb +87 -0
- data/lib/roby/transactions.rb +462 -0
- data/lib/roby/transactions/proxy.rb +292 -0
- data/lib/roby/transactions/updates.rb +139 -0
- data/plugins/fault_injection/History.txt +4 -0
- data/plugins/fault_injection/README.txt +37 -0
- data/plugins/fault_injection/Rakefile +18 -0
- data/plugins/fault_injection/TODO.txt +0 -0
- data/plugins/fault_injection/app.rb +52 -0
- data/plugins/fault_injection/fault_injection.rb +89 -0
- data/plugins/fault_injection/test/test_fault_injection.rb +84 -0
- data/plugins/subsystems/README.txt +40 -0
- data/plugins/subsystems/Rakefile +18 -0
- data/plugins/subsystems/app.rb +171 -0
- data/plugins/subsystems/test/app/README +24 -0
- data/plugins/subsystems/test/app/Rakefile +8 -0
- data/plugins/subsystems/test/app/config/app.yml +71 -0
- data/plugins/subsystems/test/app/config/init.rb +9 -0
- data/plugins/subsystems/test/app/config/roby.yml +3 -0
- data/plugins/subsystems/test/app/planners/main.rb +20 -0
- data/plugins/subsystems/test/app/scripts/distributed +3 -0
- data/plugins/subsystems/test/app/scripts/replay +3 -0
- data/plugins/subsystems/test/app/scripts/results +3 -0
- data/plugins/subsystems/test/app/scripts/run +3 -0
- data/plugins/subsystems/test/app/scripts/server +3 -0
- data/plugins/subsystems/test/app/scripts/shell +3 -0
- data/plugins/subsystems/test/app/scripts/test +3 -0
- data/plugins/subsystems/test/app/tasks/services.rb +15 -0
- data/plugins/subsystems/test/test_subsystems.rb +71 -0
- data/test/distributed/test_communication.rb +178 -0
- data/test/distributed/test_connection.rb +282 -0
- data/test/distributed/test_execution.rb +373 -0
- data/test/distributed/test_mixed_plan.rb +341 -0
- data/test/distributed/test_plan_notifications.rb +238 -0
- data/test/distributed/test_protocol.rb +516 -0
- data/test/distributed/test_query.rb +102 -0
- data/test/distributed/test_remote_plan.rb +491 -0
- data/test/distributed/test_transaction.rb +463 -0
- data/test/mockups/tasks.rb +27 -0
- data/test/planning/test_loops.rb +380 -0
- data/test/planning/test_model.rb +427 -0
- data/test/planning/test_task.rb +106 -0
- data/test/relations/test_conflicts.rb +42 -0
- data/test/relations/test_ensured.rb +38 -0
- data/test/relations/test_executed_by.rb +149 -0
- data/test/relations/test_hierarchy.rb +158 -0
- data/test/relations/test_planned_by.rb +54 -0
- data/test/suite_core.rb +24 -0
- data/test/suite_distributed.rb +9 -0
- data/test/suite_planning.rb +3 -0
- data/test/suite_relations.rb +8 -0
- data/test/test_bgl.rb +508 -0
- data/test/test_control.rb +399 -0
- data/test/test_event.rb +894 -0
- data/test/test_exceptions.rb +592 -0
- data/test/test_interface.rb +37 -0
- data/test/test_log.rb +114 -0
- data/test/test_log_server.rb +132 -0
- data/test/test_plan.rb +584 -0
- data/test/test_propagation.rb +210 -0
- data/test/test_query.rb +266 -0
- data/test/test_relations.rb +180 -0
- data/test/test_state.rb +414 -0
- data/test/test_support.rb +16 -0
- data/test/test_task.rb +938 -0
- data/test/test_testcase.rb +122 -0
- data/test/test_thread_task.rb +73 -0
- data/test/test_transactions.rb +569 -0
- data/test/test_transactions_proxy.rb +198 -0
- metadata +570 -0
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
// (C) Copyright Sylvain Joyeux 2006
|
|
2
|
+
//
|
|
3
|
+
// Original code from reverse_graph adaptor
|
|
4
|
+
// (C) Copyright David Abrahams 2000.
|
|
5
|
+
//
|
|
6
|
+
// Distributed under the Boost Software License, Version 1.0. (See
|
|
7
|
+
// accompanying file LICENSE_1_0.txt or copy at
|
|
8
|
+
// http://www.boost.org/LICENSE_1_0.txt)
|
|
9
|
+
|
|
10
|
+
#ifndef UNDIRECTED_GRAPH_HPP
|
|
11
|
+
#define UNDIRECTED_GRAPH_HPP
|
|
12
|
+
|
|
13
|
+
#include <boost/graph/adjacency_iterator.hpp>
|
|
14
|
+
#include <boost/graph/properties.hpp>
|
|
15
|
+
#include <boost/static_assert.hpp>
|
|
16
|
+
#include "iterator_sequence.hh"
|
|
17
|
+
#include <boost/iterator/transform_iterator.hpp>
|
|
18
|
+
|
|
19
|
+
#include <boost/type_traits.hpp>
|
|
20
|
+
|
|
21
|
+
namespace utilmm {
|
|
22
|
+
struct undirected_graph_tag { };
|
|
23
|
+
|
|
24
|
+
/** undirected_graph creates an undirected graph from a bidirectional graph. This can allow
|
|
25
|
+
* to use some undirected-graph-only algorithms on bidirectional graphs
|
|
26
|
+
*/
|
|
27
|
+
template <class BidirectionalGraph, class GraphRef = const BidirectionalGraph&>
|
|
28
|
+
class undirected_graph {
|
|
29
|
+
typedef undirected_graph<BidirectionalGraph, GraphRef> Self;
|
|
30
|
+
typedef boost::graph_traits<BidirectionalGraph> Traits;
|
|
31
|
+
|
|
32
|
+
BOOST_STATIC_ASSERT(( boost::is_same<boost::bidirectional_tag, typename BidirectionalGraph::directed_category>::value ));
|
|
33
|
+
|
|
34
|
+
public:
|
|
35
|
+
typedef BidirectionalGraph base_type;
|
|
36
|
+
|
|
37
|
+
// Constructor
|
|
38
|
+
undirected_graph(GraphRef g) : m_g(g) {}
|
|
39
|
+
|
|
40
|
+
// Graph requirements
|
|
41
|
+
typedef typename Traits::vertex_descriptor vertex_descriptor;
|
|
42
|
+
typedef boost::undirected_tag directed_category;
|
|
43
|
+
typedef typename Traits::edge_parallel_category edge_parallel_category;
|
|
44
|
+
typedef typename Traits::traversal_category traversal_category;
|
|
45
|
+
|
|
46
|
+
// Add a 'reverse' flag to edge descriptors, so that source() and target() know what
|
|
47
|
+
// needs to be done
|
|
48
|
+
typedef std::pair<typename Traits::edge_descriptor, bool> edge_descriptor;
|
|
49
|
+
typedef edge_descriptor (*make_undirected_edge_descriptor)(typename Traits::edge_descriptor);
|
|
50
|
+
|
|
51
|
+
// Out edges do not need to be swapped
|
|
52
|
+
static edge_descriptor make_out_edge_descriptor(typename Traits::edge_descriptor e)
|
|
53
|
+
{ return make_pair(e, false); }
|
|
54
|
+
class base_out_edge_iterator :
|
|
55
|
+
public boost::transform_iterator<make_undirected_edge_descriptor, typename Traits::out_edge_iterator>
|
|
56
|
+
{
|
|
57
|
+
typedef boost::transform_iterator<make_undirected_edge_descriptor, typename Traits::out_edge_iterator>
|
|
58
|
+
base_type;
|
|
59
|
+
|
|
60
|
+
public:
|
|
61
|
+
base_out_edge_iterator() {}
|
|
62
|
+
base_out_edge_iterator(typename Traits::out_edge_iterator e)
|
|
63
|
+
: base_type(e, make_out_edge_descriptor) {}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
static edge_descriptor make_in_edge_descriptor(typename Traits::edge_descriptor e)
|
|
67
|
+
{ return make_pair(e, true); }
|
|
68
|
+
class base_in_edge_iterator :
|
|
69
|
+
public boost::transform_iterator<make_undirected_edge_descriptor, typename Traits::in_edge_iterator>
|
|
70
|
+
{
|
|
71
|
+
typedef boost::transform_iterator<make_undirected_edge_descriptor, typename Traits::in_edge_iterator>
|
|
72
|
+
base_type;
|
|
73
|
+
|
|
74
|
+
public:
|
|
75
|
+
base_in_edge_iterator() {}
|
|
76
|
+
base_in_edge_iterator(typename Traits::in_edge_iterator e)
|
|
77
|
+
: base_type(e, make_in_edge_descriptor) {}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// Do not swap plain edge iterators
|
|
81
|
+
class edge_iterator :
|
|
82
|
+
public boost::transform_iterator<make_undirected_edge_descriptor, typename Traits::edge_iterator>
|
|
83
|
+
{
|
|
84
|
+
typedef boost::transform_iterator<make_undirected_edge_descriptor, typename Traits::edge_iterator>
|
|
85
|
+
base_type;
|
|
86
|
+
public:
|
|
87
|
+
edge_iterator() {}
|
|
88
|
+
edge_iterator(typename Traits::edge_iterator e)
|
|
89
|
+
: base_type(e, make_out_edge_descriptor) {}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// IncidenceGraph requirements
|
|
93
|
+
typedef typename Traits::degree_size_type degree_size_type;
|
|
94
|
+
typedef iterator_sequence
|
|
95
|
+
< base_in_edge_iterator
|
|
96
|
+
, base_out_edge_iterator
|
|
97
|
+
> in_edge_iterator;
|
|
98
|
+
typedef in_edge_iterator out_edge_iterator;
|
|
99
|
+
|
|
100
|
+
// AdjacencyGraph requirements
|
|
101
|
+
typedef iterator_sequence
|
|
102
|
+
< typename Traits::adjacency_iterator
|
|
103
|
+
, typename BidirectionalGraph::inv_adjacency_iterator
|
|
104
|
+
> adjacency_iterator;
|
|
105
|
+
typedef adjacency_iterator inv_adjacency_iterator;
|
|
106
|
+
|
|
107
|
+
// VertexListGraph requirements
|
|
108
|
+
typedef typename Traits::vertex_iterator vertex_iterator;
|
|
109
|
+
|
|
110
|
+
// EdgeListGraph requirements
|
|
111
|
+
typedef typename Traits::edge_iterator edge_iterator;
|
|
112
|
+
typedef typename Traits::vertices_size_type vertices_size_type;
|
|
113
|
+
typedef typename Traits::edges_size_type edges_size_type;
|
|
114
|
+
|
|
115
|
+
// More typedefs used by detail::edge_property_map, vertex_property_map
|
|
116
|
+
typedef typename BidirectionalGraph::edge_property_type
|
|
117
|
+
edge_property_type;
|
|
118
|
+
typedef typename BidirectionalGraph::vertex_property_type
|
|
119
|
+
vertex_property_type;
|
|
120
|
+
typedef undirected_graph_tag graph_tag;
|
|
121
|
+
|
|
122
|
+
static vertex_descriptor null_vertex()
|
|
123
|
+
{ return Traits::null_vertex(); }
|
|
124
|
+
|
|
125
|
+
// Bundled properties support
|
|
126
|
+
typename boost::graph::detail::bundled_result<BidirectionalGraph,
|
|
127
|
+
edge_descriptor>::type&
|
|
128
|
+
operator[](edge_descriptor x)
|
|
129
|
+
{ return m_g[x.first]; }
|
|
130
|
+
|
|
131
|
+
typename boost::graph::detail::bundled_result<BidirectionalGraph,
|
|
132
|
+
edge_descriptor>::type const&
|
|
133
|
+
operator[](edge_descriptor x) const
|
|
134
|
+
{ return m_g[x.first]; }
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
typename boost::graph::detail::bundled_result<BidirectionalGraph,
|
|
139
|
+
vertex_descriptor>::type&
|
|
140
|
+
operator[](vertex_descriptor x)
|
|
141
|
+
{ return m_g[x]; }
|
|
142
|
+
|
|
143
|
+
typename boost::graph::detail::bundled_result<BidirectionalGraph,
|
|
144
|
+
vertex_descriptor>::type const&
|
|
145
|
+
operator[](vertex_descriptor x) const
|
|
146
|
+
{ return m_g[x]; }
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
// would be private, but template friends aren't portable enough.
|
|
150
|
+
// private:
|
|
151
|
+
GraphRef m_g;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
template <class BidirectionalGraph>
|
|
155
|
+
inline undirected_graph<BidirectionalGraph>
|
|
156
|
+
make_undirected_graph(const BidirectionalGraph& g)
|
|
157
|
+
{
|
|
158
|
+
return undirected_graph<BidirectionalGraph>(g);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
template <class BidirectionalGraph>
|
|
162
|
+
inline undirected_graph<BidirectionalGraph, BidirectionalGraph&>
|
|
163
|
+
make_undirected_graph(BidirectionalGraph& g)
|
|
164
|
+
{
|
|
165
|
+
return undirected_graph<BidirectionalGraph, BidirectionalGraph&>(g);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
template <class BidirectionalGraph, class GRef>
|
|
169
|
+
std::pair<typename undirected_graph<BidirectionalGraph>::vertex_iterator,
|
|
170
|
+
typename undirected_graph<BidirectionalGraph>::vertex_iterator>
|
|
171
|
+
vertices(const undirected_graph<BidirectionalGraph,GRef>& g)
|
|
172
|
+
{
|
|
173
|
+
return vertices(g.m_g);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
template <class BidirectionalGraph, class GRef>
|
|
177
|
+
std::pair<typename undirected_graph<BidirectionalGraph>::edge_iterator,
|
|
178
|
+
typename undirected_graph<BidirectionalGraph>::edge_iterator>
|
|
179
|
+
edges(const undirected_graph<BidirectionalGraph,GRef>& g)
|
|
180
|
+
{
|
|
181
|
+
return edges(g.m_g);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
template <class BidirectionalGraph, class GRef>
|
|
185
|
+
inline std::pair<typename undirected_graph<BidirectionalGraph,GRef>::out_edge_iterator,
|
|
186
|
+
typename undirected_graph<BidirectionalGraph,GRef>::out_edge_iterator>
|
|
187
|
+
out_edges(const typename BidirectionalGraph::vertex_descriptor u,
|
|
188
|
+
const undirected_graph<BidirectionalGraph,GRef>& g)
|
|
189
|
+
{
|
|
190
|
+
std::pair<typename BidirectionalGraph::out_edge_iterator,
|
|
191
|
+
typename BidirectionalGraph::out_edge_iterator>
|
|
192
|
+
out_edges = boost::out_edges(u, g.m_g);
|
|
193
|
+
std::pair<typename BidirectionalGraph::in_edge_iterator,
|
|
194
|
+
typename BidirectionalGraph::in_edge_iterator>
|
|
195
|
+
in_edges = boost::in_edges(u, g.m_g);
|
|
196
|
+
|
|
197
|
+
typedef typename undirected_graph<BidirectionalGraph,GRef>::out_edge_iterator edge_iterator;
|
|
198
|
+
return make_pair(
|
|
199
|
+
edge_iterator(in_edges.first, in_edges.second, out_edges.first, out_edges.first),
|
|
200
|
+
edge_iterator(in_edges.second, in_edges.second, out_edges.second, out_edges.second));
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
template <class BidirectionalGraph, class GRef>
|
|
204
|
+
inline typename BidirectionalGraph::vertices_size_type
|
|
205
|
+
num_vertices(const undirected_graph<BidirectionalGraph,GRef>& g)
|
|
206
|
+
{
|
|
207
|
+
return num_vertices(g.m_g);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
template <class BidirectionalGraph, class GRef>
|
|
211
|
+
inline typename undirected_graph<BidirectionalGraph>::edges_size_type
|
|
212
|
+
num_edges(const undirected_graph<BidirectionalGraph,GRef>& g)
|
|
213
|
+
{
|
|
214
|
+
return num_edges(g.m_g);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
template <class BidirectionalGraph, class GRef>
|
|
218
|
+
inline typename BidirectionalGraph::degree_size_type
|
|
219
|
+
out_degree(const typename BidirectionalGraph::vertex_descriptor u,
|
|
220
|
+
const undirected_graph<BidirectionalGraph,GRef>& g)
|
|
221
|
+
{
|
|
222
|
+
return in_degree(u, g.m_g) + out_degree(u, g.m_g);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
template <class BidirectionalGraph, class GRef>
|
|
226
|
+
inline std::pair<typename BidirectionalGraph::edge_descriptor, bool>
|
|
227
|
+
edge(const typename BidirectionalGraph::vertex_descriptor u,
|
|
228
|
+
const typename BidirectionalGraph::vertex_descriptor v,
|
|
229
|
+
const undirected_graph<BidirectionalGraph,GRef>& g)
|
|
230
|
+
{
|
|
231
|
+
return edge(v, u, g.m_g);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
template <class BidirectionalGraph, class GRef>
|
|
235
|
+
inline std::pair<typename BidirectionalGraph::out_edge_iterator,
|
|
236
|
+
typename BidirectionalGraph::out_edge_iterator>
|
|
237
|
+
in_edges(const typename BidirectionalGraph::vertex_descriptor u,
|
|
238
|
+
const undirected_graph<BidirectionalGraph,GRef>& g)
|
|
239
|
+
{ return out_edges(u, g); }
|
|
240
|
+
|
|
241
|
+
template <class BidirectionalGraph, class GRef>
|
|
242
|
+
inline std::pair<typename undirected_graph<BidirectionalGraph,GRef>::adjacency_iterator,
|
|
243
|
+
typename undirected_graph<BidirectionalGraph,GRef>::adjacency_iterator>
|
|
244
|
+
adjacent_vertices(const typename BidirectionalGraph::vertex_descriptor u,
|
|
245
|
+
const undirected_graph<BidirectionalGraph,GRef>& g)
|
|
246
|
+
{
|
|
247
|
+
std::pair<typename BidirectionalGraph::adjacency_iterator,
|
|
248
|
+
typename BidirectionalGraph::adjacency_iterator>
|
|
249
|
+
adjacency = boost::adjacent_vertices(u, g.m_g);
|
|
250
|
+
std::pair<typename BidirectionalGraph::inv_adjacency_iterator,
|
|
251
|
+
typename BidirectionalGraph::inv_adjacency_iterator>
|
|
252
|
+
inv_adjacency = boost::inv_adjacent_vertices(u, g.m_g);
|
|
253
|
+
|
|
254
|
+
typedef typename undirected_graph<BidirectionalGraph,GRef>::adjacency_iterator adjacency_iterator;
|
|
255
|
+
return std::make_pair(
|
|
256
|
+
adjacency_iterator(adjacency.first, adjacency.second, inv_adjacency.first, inv_adjacency.first),
|
|
257
|
+
adjacency_iterator(adjacency.second, adjacency.second, inv_adjacency.second, inv_adjacency.second));
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
template <class BidirectionalGraph, class GRef>
|
|
261
|
+
inline typename BidirectionalGraph::degree_size_type
|
|
262
|
+
in_degree(const typename BidirectionalGraph::vertex_descriptor u,
|
|
263
|
+
const undirected_graph<BidirectionalGraph,GRef>& g)
|
|
264
|
+
{ return out_degree(u, g); }
|
|
265
|
+
|
|
266
|
+
template <class Edge, class BidirectionalGraph, class GRef>
|
|
267
|
+
inline typename boost::graph_traits<BidirectionalGraph>::vertex_descriptor
|
|
268
|
+
source(const Edge& e, const undirected_graph<BidirectionalGraph,GRef>& g)
|
|
269
|
+
{
|
|
270
|
+
if (e.second)
|
|
271
|
+
return target(e.first, g.m_g);
|
|
272
|
+
else
|
|
273
|
+
return source(e.first, g.m_g);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
template <class Edge, class BidirectionalGraph, class GRef>
|
|
277
|
+
inline typename boost::graph_traits<BidirectionalGraph>::vertex_descriptor
|
|
278
|
+
target(const Edge& e, const undirected_graph<BidirectionalGraph,GRef>& g)
|
|
279
|
+
{
|
|
280
|
+
if (e.second)
|
|
281
|
+
return source(e.first, g.m_g);
|
|
282
|
+
else
|
|
283
|
+
return target(e.first, g.m_g);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
namespace detail {
|
|
288
|
+
|
|
289
|
+
struct undirected_graph_vertex_property_selector {
|
|
290
|
+
template <class UndirectedGraph, class Property, class Tag>
|
|
291
|
+
struct bind_ {
|
|
292
|
+
typedef typename UndirectedGraph::base_type Graph;
|
|
293
|
+
typedef boost::property_map<Graph, Tag> PMap;
|
|
294
|
+
typedef typename PMap::type type;
|
|
295
|
+
typedef typename PMap::const_type const_type;
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
struct undirected_graph_edge_property_selector {
|
|
300
|
+
template <class UndirectedGraph, class Property, class Tag>
|
|
301
|
+
struct bind_ {
|
|
302
|
+
typedef typename UndirectedGraph::base_type Graph;
|
|
303
|
+
typedef boost::property_map<Graph, Tag> PMap;
|
|
304
|
+
typedef typename PMap::type type;
|
|
305
|
+
typedef typename PMap::const_type const_type;
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
} // namespace detail
|
|
310
|
+
|
|
311
|
+
/** This class adapts a property map on the edges of a graph to a property map
|
|
312
|
+
* on the edges of the corresponding undirected graph */
|
|
313
|
+
template<typename PropertyMap>
|
|
314
|
+
class undirected_property_map
|
|
315
|
+
{
|
|
316
|
+
public:
|
|
317
|
+
undirected_property_map(PropertyMap pmap)
|
|
318
|
+
: m_map(pmap) {}
|
|
319
|
+
|
|
320
|
+
PropertyMap& map() { return m_map; }
|
|
321
|
+
PropertyMap const& map() const { return m_map; }
|
|
322
|
+
|
|
323
|
+
private:
|
|
324
|
+
PropertyMap m_map;
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
template<typename PropertyMap, typename EdgeDescriptor, typename ValueType>
|
|
328
|
+
void put(undirected_property_map<PropertyMap>& map,
|
|
329
|
+
EdgeDescriptor e, ValueType value)
|
|
330
|
+
{ put(map.map(), e.first, value); }
|
|
331
|
+
template<typename PropertyMap, typename EdgeDescriptor>
|
|
332
|
+
typename boost::property_traits<PropertyMap>::value_type
|
|
333
|
+
get(undirected_property_map<PropertyMap> const& map,
|
|
334
|
+
EdgeDescriptor e)
|
|
335
|
+
{ return get(map.map(), e.first); }
|
|
336
|
+
|
|
337
|
+
template<typename PropertyMap>
|
|
338
|
+
undirected_property_map<PropertyMap> make_undirected_edge_map(PropertyMap pmap)
|
|
339
|
+
{ return undirected_property_map<PropertyMap>(pmap); }
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
} // namespace utilmm
|
|
343
|
+
|
|
344
|
+
// Include specialization in the boost namespace
|
|
345
|
+
namespace boost {
|
|
346
|
+
template<typename PropertyMap>
|
|
347
|
+
struct property_traits< utilmm::undirected_property_map<PropertyMap> >
|
|
348
|
+
: property_traits<PropertyMap> {};
|
|
349
|
+
|
|
350
|
+
template <>
|
|
351
|
+
struct vertex_property_selector<utilmm::undirected_graph_tag> {
|
|
352
|
+
typedef utilmm::detail::undirected_graph_vertex_property_selector type;
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
template <>
|
|
356
|
+
struct edge_property_selector<utilmm::undirected_graph_tag> {
|
|
357
|
+
typedef utilmm::detail::undirected_graph_edge_property_selector type;
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
namespace detail {
|
|
361
|
+
template<typename BidirGraph, typename GRef, typename Property>
|
|
362
|
+
struct get_property_map_type { };
|
|
363
|
+
template<typename BidirGraph, typename Property>
|
|
364
|
+
struct get_property_map_type<BidirGraph, const BidirGraph&, Property>
|
|
365
|
+
{ typedef typename property_map<BidirGraph, Property>::const_type type; };
|
|
366
|
+
template<typename BidirGraph, typename Property>
|
|
367
|
+
struct get_property_map_type<BidirGraph, BidirGraph&, Property>
|
|
368
|
+
{ typedef typename property_map<BidirGraph, Property>::type type; };
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
template <class BidirGraph, class GRef, class Property>
|
|
372
|
+
typename detail::get_property_map_type<BidirGraph, GRef, Property>::type
|
|
373
|
+
get(Property p, utilmm::undirected_graph<BidirGraph,GRef>& g)
|
|
374
|
+
{
|
|
375
|
+
return get(p, g.m_g);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
template <class BidirGraph, class GRef, class Property>
|
|
379
|
+
typename detail::get_property_map_type<BidirGraph, GRef, Property>::type
|
|
380
|
+
get(Property p, const utilmm::undirected_graph<BidirGraph,GRef>& g)
|
|
381
|
+
{
|
|
382
|
+
return get(p, g.m_g);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
template <class BidirectionalGraph, class GRef, class Property, class Key>
|
|
386
|
+
typename property_traits<
|
|
387
|
+
typename property_map<BidirectionalGraph, Property>::const_type
|
|
388
|
+
>::value_type
|
|
389
|
+
get(Property p, const utilmm::undirected_graph<BidirectionalGraph,GRef>& g, const Key& k)
|
|
390
|
+
{
|
|
391
|
+
return get(p, g.m_g, k);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
template <class BidirectionalGraph, class GRef, class Property, class Key, class Value>
|
|
395
|
+
void
|
|
396
|
+
put(Property p, const utilmm::undirected_graph<BidirectionalGraph,GRef>& g, const Key& k,
|
|
397
|
+
const Value& val)
|
|
398
|
+
{
|
|
399
|
+
put(p, g.m_g, k, val);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
template<typename BidirectionalGraph, typename GRef, typename Tag,
|
|
403
|
+
typename Value>
|
|
404
|
+
inline void
|
|
405
|
+
set_property(const utilmm::undirected_graph<BidirectionalGraph,GRef>& g, Tag tag,
|
|
406
|
+
const Value& value)
|
|
407
|
+
{
|
|
408
|
+
set_property(g.m_g, tag, value);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
template<typename BidirectionalGraph, typename GRef, typename Tag>
|
|
412
|
+
inline
|
|
413
|
+
typename graph_property<BidirectionalGraph, Tag>::type
|
|
414
|
+
get_property(const utilmm::undirected_graph<BidirectionalGraph,GRef>& g, Tag tag)
|
|
415
|
+
{
|
|
416
|
+
return get_property(g.m_g, tag);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
} // namespace boost
|
|
420
|
+
|
|
421
|
+
#endif
|
data/lib/roby.rb
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# The main namespace for the Roby library. The namespace is divided as follows:
|
|
2
|
+
#
|
|
3
|
+
# [Roby] core namespace for the Roby kernel
|
|
4
|
+
# [Roby::Distributed] parts that are very specific to distributed plan management
|
|
5
|
+
# [Roby::Planning] basic tools for plan generation
|
|
6
|
+
# [Roby::Transactions] implementation of transactions
|
|
7
|
+
# [Roby::EventStructure] event relations
|
|
8
|
+
# [Roby::TaskStructure] task relations
|
|
9
|
+
module Roby
|
|
10
|
+
class BasicObject; end
|
|
11
|
+
class PlanObject < BasicObject; end
|
|
12
|
+
class Plan < BasicObject; end
|
|
13
|
+
class Control; end
|
|
14
|
+
class EventGenerator < PlanObject; end
|
|
15
|
+
class Task < PlanObject; end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
require 'roby/support'
|
|
19
|
+
require 'roby/task'
|
|
20
|
+
require 'roby/event'
|
|
21
|
+
require 'roby/standard_errors'
|
|
22
|
+
|
|
23
|
+
require 'roby/plan'
|
|
24
|
+
require 'roby/query'
|
|
25
|
+
require 'roby/control'
|
|
26
|
+
require 'roby/decision_control'
|
|
27
|
+
|
|
28
|
+
require 'roby/propagation'
|
|
29
|
+
require 'roby/relations/events'
|
|
30
|
+
require 'roby/relations/hierarchy'
|
|
31
|
+
require 'roby/relations/influence'
|
|
32
|
+
require 'roby/relations/planned_by'
|
|
33
|
+
require 'roby/relations/executed_by'
|
|
34
|
+
require 'roby/relations/ensured'
|
|
35
|
+
|
|
36
|
+
require 'roby/state'
|
|
37
|
+
require 'roby/interface'
|
|
38
|
+
|
|
39
|
+
require 'roby/distributed/protocol'
|
|
40
|
+
|
|
41
|
+
require 'roby/app'
|