roby 0.7.3 → 0.8.0

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.
Files changed (236) hide show
  1. data/History.txt +7 -5
  2. data/Manifest.txt +91 -16
  3. data/README.txt +24 -24
  4. data/Rakefile +92 -64
  5. data/app/config/app.yml +42 -43
  6. data/app/config/init.rb +26 -0
  7. data/benchmark/alloc_misc.rb +123 -0
  8. data/benchmark/discovery_latency.rb +67 -0
  9. data/benchmark/garbage_collection.rb +48 -0
  10. data/benchmark/genom.rb +31 -0
  11. data/benchmark/transactions.rb +62 -0
  12. data/bin/roby +1 -1
  13. data/bin/roby-log +16 -6
  14. data/doc/guide/.gitignore +2 -0
  15. data/doc/guide/config.yaml +34 -0
  16. data/doc/guide/ext/init.rb +14 -0
  17. data/doc/guide/ext/previous_next.rb +40 -0
  18. data/doc/guide/ext/rdoc_links.rb +33 -0
  19. data/doc/guide/index.rdoc +16 -0
  20. data/doc/guide/overview.rdoc +62 -0
  21. data/doc/guide/plan_modifications.rdoc +67 -0
  22. data/doc/guide/src/abstraction/achieve_with.page +8 -0
  23. data/doc/guide/src/abstraction/forwarding.page +8 -0
  24. data/doc/guide/src/abstraction/hierarchy.page +19 -0
  25. data/doc/guide/src/abstraction/index.page +28 -0
  26. data/doc/guide/src/abstraction/task_models.page +13 -0
  27. data/doc/guide/src/basics.template +6 -0
  28. data/doc/guide/src/basics/app.page +139 -0
  29. data/doc/guide/src/basics/code_examples.page +33 -0
  30. data/doc/guide/src/basics/dry.page +69 -0
  31. data/doc/guide/src/basics/errors.page +443 -0
  32. data/doc/guide/src/basics/events.page +179 -0
  33. data/doc/guide/src/basics/hierarchy.page +275 -0
  34. data/doc/guide/src/basics/index.page +11 -0
  35. data/doc/guide/src/basics/log_replay/goForward_1.png +0 -0
  36. data/doc/guide/src/basics/log_replay/goForward_2.png +0 -0
  37. data/doc/guide/src/basics/log_replay/goForward_3.png +0 -0
  38. data/doc/guide/src/basics/log_replay/goForward_4.png +0 -0
  39. data/doc/guide/src/basics/log_replay/goForward_5.png +0 -0
  40. data/doc/guide/src/basics/log_replay/hierarchy_error_1.png +0 -0
  41. data/doc/guide/src/basics/log_replay/hierarchy_error_2.png +0 -0
  42. data/doc/guide/src/basics/log_replay/hierarchy_error_3.png +0 -0
  43. data/doc/guide/src/basics/log_replay/plan_repair_1.png +0 -0
  44. data/doc/guide/src/basics/log_replay/plan_repair_2.png +0 -0
  45. data/doc/guide/src/basics/log_replay/plan_repair_3.png +0 -0
  46. data/doc/guide/src/basics/log_replay/plan_repair_4.png +0 -0
  47. data/doc/guide/src/basics/log_replay/roby_log_main_window.png +0 -0
  48. data/doc/guide/src/basics/log_replay/roby_log_relation_window.png +0 -0
  49. data/doc/guide/src/basics/log_replay/roby_replay_event_representation.png +0 -0
  50. data/doc/guide/src/basics/plan_objects.page +71 -0
  51. data/doc/guide/src/basics/relations_display.page +203 -0
  52. data/doc/guide/src/basics/roby_cycle_overview.png +0 -0
  53. data/doc/guide/src/basics/shell.page +102 -0
  54. data/doc/guide/src/basics/summary.page +32 -0
  55. data/doc/guide/src/basics/tasks.page +357 -0
  56. data/doc/guide/src/basics_shell_header.txt +16 -0
  57. data/doc/guide/src/cycle/cycle-overview.png +0 -0
  58. data/doc/guide/src/cycle/cycle-overview.svg +208 -0
  59. data/doc/guide/src/cycle/error_handling.page +168 -0
  60. data/doc/guide/src/cycle/error_instantaneous_repair.png +0 -0
  61. data/doc/guide/src/cycle/error_instantaneous_repair.svg +1224 -0
  62. data/doc/guide/src/cycle/garbage_collection.page +10 -0
  63. data/doc/guide/src/cycle/index.page +23 -0
  64. data/doc/guide/src/cycle/propagation.page +154 -0
  65. data/doc/guide/src/cycle/propagation_diamond.png +0 -0
  66. data/doc/guide/src/cycle/propagation_diamond.svg +1279 -0
  67. data/doc/guide/src/default.css +319 -0
  68. data/doc/guide/src/default.template +74 -0
  69. data/doc/guide/src/htmldoc.metainfo +20 -0
  70. data/doc/guide/src/htmldoc.virtual +18 -0
  71. data/doc/guide/src/images/bodybg.png +0 -0
  72. data/doc/guide/src/images/contbg.png +0 -0
  73. data/doc/guide/src/images/footerbg.png +0 -0
  74. data/doc/guide/src/images/gradient1.png +0 -0
  75. data/doc/guide/src/images/gradient2.png +0 -0
  76. data/doc/guide/src/index.page +7 -0
  77. data/doc/guide/src/introduction/index.page +29 -0
  78. data/doc/guide/src/introduction/install.page +133 -0
  79. data/doc/{papers.rdoc → guide/src/introduction/publications.page} +5 -2
  80. data/doc/{videos.rdoc → guide/src/introduction/videos.page} +4 -2
  81. data/doc/guide/src/plugins/fault_tolerance.page +44 -0
  82. data/doc/guide/src/plugins/index.page +11 -0
  83. data/doc/guide/src/plugins/subsystems.page +45 -0
  84. data/doc/guide/src/relations/dependency.page +89 -0
  85. data/doc/guide/src/relations/index.page +12 -0
  86. data/doc/misc/update_github +24 -0
  87. data/doc/tutorials/02-GoForward.rdoc +3 -3
  88. data/ext/graph/graph.cc +46 -0
  89. data/lib/roby.rb +57 -22
  90. data/lib/roby/app.rb +132 -112
  91. data/lib/roby/app/plugins/rake.rb +21 -0
  92. data/lib/roby/app/rake.rb +0 -7
  93. data/lib/roby/app/run.rb +1 -1
  94. data/lib/roby/app/scripts/distributed.rb +1 -2
  95. data/lib/roby/app/scripts/generate/bookmarks.rb +1 -1
  96. data/lib/roby/app/scripts/results.rb +2 -1
  97. data/lib/roby/app/scripts/run.rb +6 -2
  98. data/lib/roby/app/scripts/shell.rb +11 -11
  99. data/lib/roby/config.rb +1 -1
  100. data/lib/roby/decision_control.rb +62 -3
  101. data/lib/roby/distributed.rb +4 -0
  102. data/lib/roby/distributed/base.rb +8 -0
  103. data/lib/roby/distributed/communication.rb +12 -8
  104. data/lib/roby/distributed/connection_space.rb +61 -44
  105. data/lib/roby/distributed/distributed_object.rb +1 -1
  106. data/lib/roby/distributed/notifications.rb +22 -30
  107. data/lib/roby/distributed/peer.rb +13 -8
  108. data/lib/roby/distributed/proxy.rb +5 -5
  109. data/lib/roby/distributed/subscription.rb +4 -4
  110. data/lib/roby/distributed/transaction.rb +3 -3
  111. data/lib/roby/event.rb +176 -110
  112. data/lib/roby/exceptions.rb +12 -4
  113. data/lib/roby/execution_engine.rb +1604 -0
  114. data/lib/roby/external_process_task.rb +225 -0
  115. data/lib/roby/graph.rb +0 -6
  116. data/lib/roby/interface.rb +221 -137
  117. data/lib/roby/log/console.rb +5 -3
  118. data/lib/roby/log/data_stream.rb +94 -16
  119. data/lib/roby/log/dot.rb +8 -8
  120. data/lib/roby/log/event_stream.rb +13 -3
  121. data/lib/roby/log/file.rb +43 -18
  122. data/lib/roby/log/gui/basic_display_ui.rb +89 -0
  123. data/lib/roby/log/gui/chronicle_view_ui.rb +90 -0
  124. data/lib/roby/log/gui/data_displays.rb +4 -5
  125. data/lib/roby/log/gui/data_displays_ui.rb +146 -0
  126. data/lib/roby/log/gui/relations.rb +18 -18
  127. data/lib/roby/log/gui/relations_ui.rb +120 -0
  128. data/lib/roby/log/gui/relations_view_ui.rb +144 -0
  129. data/lib/roby/log/gui/replay.rb +41 -13
  130. data/lib/roby/log/gui/replay_controls.rb +3 -0
  131. data/lib/roby/log/gui/replay_controls.ui +133 -110
  132. data/lib/roby/log/gui/replay_controls_ui.rb +249 -0
  133. data/lib/roby/log/hooks.rb +19 -18
  134. data/lib/roby/log/logger.rb +7 -6
  135. data/lib/roby/log/notifications.rb +4 -4
  136. data/lib/roby/log/plan_rebuilder.rb +20 -22
  137. data/lib/roby/log/relations.rb +44 -16
  138. data/lib/roby/log/server.rb +1 -4
  139. data/lib/roby/log/timings.rb +88 -19
  140. data/lib/roby/plan-object.rb +135 -11
  141. data/lib/roby/plan.rb +408 -224
  142. data/lib/roby/planning/loops.rb +32 -25
  143. data/lib/roby/planning/model.rb +157 -51
  144. data/lib/roby/planning/task.rb +47 -20
  145. data/lib/roby/query.rb +128 -92
  146. data/lib/roby/relations.rb +254 -136
  147. data/lib/roby/relations/conflicts.rb +6 -9
  148. data/lib/roby/relations/dependency.rb +358 -0
  149. data/lib/roby/relations/ensured.rb +0 -1
  150. data/lib/roby/relations/error_handling.rb +0 -1
  151. data/lib/roby/relations/events.rb +0 -2
  152. data/lib/roby/relations/executed_by.rb +26 -11
  153. data/lib/roby/relations/planned_by.rb +14 -14
  154. data/lib/roby/robot.rb +46 -0
  155. data/lib/roby/schedulers/basic.rb +34 -0
  156. data/lib/roby/standalone.rb +4 -0
  157. data/lib/roby/standard_errors.rb +21 -15
  158. data/lib/roby/state/events.rb +5 -4
  159. data/lib/roby/support.rb +107 -6
  160. data/lib/roby/task-operations.rb +23 -19
  161. data/lib/roby/task.rb +522 -148
  162. data/lib/roby/task_index.rb +80 -0
  163. data/lib/roby/test/common.rb +283 -44
  164. data/lib/roby/test/distributed.rb +53 -37
  165. data/lib/roby/test/testcase.rb +9 -204
  166. data/lib/roby/test/tools.rb +3 -3
  167. data/lib/roby/transactions.rb +154 -111
  168. data/lib/roby/transactions/proxy.rb +40 -7
  169. data/manifest.xml +20 -0
  170. data/plugins/fault_injection/README.txt +0 -3
  171. data/plugins/fault_injection/Rakefile +2 -8
  172. data/plugins/fault_injection/app.rb +1 -1
  173. data/plugins/fault_injection/fault_injection.rb +3 -3
  174. data/plugins/fault_injection/test/test_fault_injection.rb +19 -25
  175. data/plugins/subsystems/README.txt +0 -3
  176. data/plugins/subsystems/Rakefile +2 -7
  177. data/plugins/subsystems/app.rb +27 -16
  178. data/plugins/subsystems/test/app/config/init.rb +3 -0
  179. data/plugins/subsystems/test/app/planners/main.rb +1 -1
  180. data/plugins/subsystems/test/app/tasks/services.rb +1 -1
  181. data/plugins/subsystems/test/test_subsystems.rb +23 -16
  182. data/test/distributed/test_communication.rb +32 -15
  183. data/test/distributed/test_connection.rb +28 -26
  184. data/test/distributed/test_execution.rb +59 -54
  185. data/test/distributed/test_mixed_plan.rb +34 -34
  186. data/test/distributed/test_plan_notifications.rb +26 -26
  187. data/test/distributed/test_protocol.rb +57 -48
  188. data/test/distributed/test_query.rb +11 -7
  189. data/test/distributed/test_remote_plan.rb +71 -71
  190. data/test/distributed/test_transaction.rb +50 -47
  191. data/test/mockups/external_process +28 -0
  192. data/test/planning/test_loops.rb +163 -119
  193. data/test/planning/test_model.rb +3 -3
  194. data/test/planning/test_task.rb +27 -7
  195. data/test/relations/test_conflicts.rb +3 -3
  196. data/test/relations/test_dependency.rb +324 -0
  197. data/test/relations/test_ensured.rb +2 -2
  198. data/test/relations/test_executed_by.rb +94 -19
  199. data/test/relations/test_planned_by.rb +11 -9
  200. data/test/suite_core.rb +6 -3
  201. data/test/suite_distributed.rb +1 -0
  202. data/test/suite_planning.rb +1 -0
  203. data/test/suite_relations.rb +2 -2
  204. data/test/tasks/test_external_process.rb +126 -0
  205. data/test/{test_thread_task.rb → tasks/test_thread_task.rb} +17 -20
  206. data/test/test_bgl.rb +21 -1
  207. data/test/test_event.rb +229 -155
  208. data/test/test_exceptions.rb +79 -80
  209. data/test/test_execution_engine.rb +987 -0
  210. data/test/test_gui.rb +1 -1
  211. data/test/test_interface.rb +11 -5
  212. data/test/test_log.rb +18 -7
  213. data/test/test_log_server.rb +1 -0
  214. data/test/test_plan.rb +229 -395
  215. data/test/test_query.rb +193 -35
  216. data/test/test_relations.rb +88 -8
  217. data/test/test_state.rb +55 -37
  218. data/test/test_support.rb +1 -1
  219. data/test/test_task.rb +371 -218
  220. data/test/test_testcase.rb +32 -16
  221. data/test/test_transactions.rb +211 -170
  222. data/test/test_transactions_proxy.rb +37 -19
  223. metadata +169 -71
  224. data/.gitignore +0 -29
  225. data/doc/styles/allison.css +0 -314
  226. data/doc/styles/allison.js +0 -316
  227. data/doc/styles/allison.rb +0 -276
  228. data/doc/styles/jamis.rb +0 -593
  229. data/lib/roby/control.rb +0 -746
  230. data/lib/roby/executives/simple.rb +0 -30
  231. data/lib/roby/propagation.rb +0 -562
  232. data/lib/roby/relations/hierarchy.rb +0 -239
  233. data/lib/roby/transactions/updates.rb +0 -139
  234. data/test/relations/test_hierarchy.rb +0 -158
  235. data/test/test_control.rb +0 -399
  236. data/test/test_propagation.rb +0 -210
@@ -0,0 +1,29 @@
1
+ ---
2
+ title: What is Roby?
3
+ routed_title: Introduction
4
+ sort_info: 0
5
+ --- pipeline:rdoc
6
+
7
+ Roby is a plan manager: it allows to represent, execute and adapt a plan, which
8
+ is a representation of the past, present and future activities of a robot along
9
+ with the information needed to verify that their executin is going well, and to
10
+ manage errors.
11
+
12
+ Roby is:
13
+ * a task/event model in which one can represent the activities (Roby::Task) and
14
+ the noticeable situations during execution (Roby::EventGenerator,
15
+ Roby::Task.event).
16
+ * a set of task relations describing the interactions between the activities
17
+ (Roby::TaskStructure).
18
+ * a set of event relations describing the reaction the system should have in
19
+ response to some situations (Roby::EventStructure).
20
+ * error management tools which allow to catch errors during execution and
21
+ repair them (i.e. let the system manage the error).
22
+ * a mean to modify the plan as it is being executed (Roby::Transaction)
23
+ * (G)UI tools for interacting/controlling the living system.
24
+ * all of that in a multi-robot context.
25
+
26
+ Roby is the result of my PhD. As such, my PhD thesis can be considered as a
27
+ design document for the system. If you want an overview of the principles, you
28
+ can also refer to the publications I did.
29
+
@@ -0,0 +1,133 @@
1
+ ---
2
+ title: Installation
3
+ sort_info: 100
4
+ --- pipeline:rdoc
5
+ == External dependencies
6
+ Roby requires ruby version 1.8.6 or 1.8.7. Ruby 1.9 is a work in progress, but
7
+ will not work with this release
8
+
9
+ * The Roby engine needs
10
+ * +utilrb+, which is available on RubyForge[http://utilrb.rubyforge.org] as a gem
11
+ * Facets, available on RubyForge[http://rubyforge.org/projects/facets] or as a gem
12
+ * ActiveSupport, available on RubyForge[http://rubyforge.org/projects/activesupport] or as a gem
13
+ * the {Boost C++ library}[www.boost.org], including Boost/Graph
14
+
15
+ * the documentation generation requires
16
+ * the RDoc gem (not the default RDoc) for the generation of the API
17
+ * the webgen gem with coderay and maruku for the generation of the user's
18
+ guide
19
+
20
+ * the test suite needs also
21
+ * FlexMock, available on RubyForge[http://rubyforge.org/projects/flexmock]
22
+
23
+ * finally, the GUI requires {QtRuby >= 1.4.9}[http://rubyforge.org/projects/korundum], SVG export requires QtRuby to
24
+ be built with Qt >= 4.3
25
+
26
+ == Before installation
27
+
28
+ Before doing anything else, you will need to have the C++ dependencies listed
29
+ above installed on your system:
30
+ * the boost C++ libraries with boost/graph
31
+ * QtRuby >= 1.4.9, compiled with Qt >= 4.3
32
+
33
+ See the next page for a step-by-step installation on Debian/Ubuntu.
34
+
35
+ All the rest can be installed with RubyGems
36
+
37
+ == Setting the environment
38
+
39
+ As a first step, you should set you environment variables. This is done by
40
+ the following commands.
41
+
42
+ export GEM_HOME=$HOME/gems/
43
+ export ROBYHOME=$HOME/roby
44
+ export RUBYOPT=-rubygems
45
+ export PATH=$PATH:$GEM_HOME/bin:$ROBYHOME/bin
46
+ export RUBYLIB=$RUBYLIB:$ROBYHOME/lib
47
+
48
+ The +GEM_HOME+ and +ROBYHOME+ should be set to wherever you want these parts to
49
+ be installed. It would be wise to append these lines to your ~/.bashrc so that
50
+ they are executed each time you start a console.
51
+
52
+ == Debian/Ubuntu: Installing binary dependencies with apt-get
53
+
54
+ You can install those packages with the following line.
55
+
56
+ sudo apt-get install ruby1.8-dev rubygems ruby libopenssl-ruby1.8
57
+ sudo apt-get install libqt4-ruby1.8 g++ libboost-dev git-core
58
+
59
+ If you don't have administrative rights on your local pc, contact your system
60
+ administrator.
61
+
62
+ == Install using RubyGems
63
+
64
+ This is as simple as
65
+
66
+ gem install roby
67
+
68
+ RubyGems will then take care of installing Roby dependencies. If you want to run
69
+ the unit tests and/or to generate the user's guide, you will need to do
70
+
71
+ gem install --development roby
72
+
73
+ == Install the development code from GitHub
74
+
75
+ To do this, you will need to install Roby's gems dependencies yourself. This is
76
+ as simple as
77
+
78
+ gem install rake utilrb facets activesupport rdoc webgen maruku coderay flexmock
79
+
80
+ All you have to do now is changing into your development folder and clone
81
+ the github repository for roby.
82
+
83
+ git clone git://github.com/doudou/roby.git roby
84
+
85
+ The last parameter (+roby+) is the folder which should be created to put
86
+ roby's files in. You can easily adjust this to your needs.
87
+
88
+ +cd+ into the newly created roby folder.
89
+
90
+ To work on the development version of roby, check it out with
91
+
92
+ git checkout -b next origin/next
93
+
94
+ Otherwise just stay on the default master branch.
95
+ To finally have a running copy of roby, run
96
+
97
+ rake setup
98
+
99
+ to compile roby on your workstation and you're done. Additionally, you can run
100
+
101
+ rake docs
102
+
103
+ To generate HTML documentation of Roby and its core plugins. The documentation
104
+ is generated in doc/html
105
+
106
+ === Staying up to date
107
+
108
+ To grab the newest updates of roby just change into your robyfolder and run
109
+
110
+ git pull
111
+
112
+ After you merged all possible conflicts between your work and the origin,
113
+ you must run
114
+
115
+ rake setup
116
+
117
+ again.
118
+
119
+ == Generating the documentation
120
+
121
+ To generate the documentation, you will need to install the following gems:
122
+
123
+ gem install webgen maruku rdoc coderay
124
+
125
+ Then, the following commands allow to generate separate parts of the
126
+ documentation:
127
+ rake doc:api # Generates the API documentation using RDoc
128
+ rake doc:guide # Generates the user's guide
129
+ rake doc:plugin_docs # Generate the plugin documentation
130
+
131
+ Alternatively, you can generate all of the above with
132
+ rake docs
133
+
@@ -1,5 +1,7 @@
1
- = Papers
2
-
1
+ ---
2
+ title: Publications
3
+ sort_info: 300
4
+ --- pipeline:tags,rdoc
3
5
  These are the papers which present Roby that I published the last years.
4
6
 
5
7
  * A Software Component for Plan Management in Robotics
@@ -9,3 +11,4 @@ These are the papers which present Roby that I published the last years.
9
11
  * A Plan Manager for Multi-Robot Systems - FSR2007
10
12
  ({paper}[http://roby.rubyforge.org/papers/roby-2007-fsr.pdf], {slides}[http://roby.rubyforge.org/papers/roby-2007-fsr-slides.pdf])
11
13
 
14
+
@@ -1,5 +1,7 @@
1
- = Videos
2
-
1
+ ---
2
+ title: Demonstration Videos
3
+ sort_info: 400
4
+ --- pipeline:tags,rdoc
3
5
  == Normal operations
4
6
 
5
7
  Those videos don't show what Roby itself does, only results showing
@@ -0,0 +1,44 @@
1
+ ---
2
+ title: Fault Injection <a href="fault_injection/index.html">[API]</a>
3
+ sort_info: 100
4
+ --- name:content pipeline:tags,markdown,blocks
5
+
6
+ This is a fault injection plugin for the Roby robotic control framework. It
7
+ allows to test the management of rarely occuring events by simulating the
8
+ emission of those events. This plugin relies only on the core Roby library.
9
+
10
+ Usage
11
+ -----
12
+
13
+ The fault injection plugin can be used in a system to inject some spurious
14
+ events randomly. To set it up, one must call Application#add\_fault\_model
15
+ in the configuration files of the application. For instance,
16
+
17
+ {coderay:: ruby}
18
+ Roby.app.add_fault_model P3d::Track,
19
+ :no_path, :blocked,
20
+ Roby::FaultInjection::Rate.new(500, 0.3)
21
+ {coderay}
22
+
23
+ Would inject events no\_path and blocked randomly on any task of the P3d:Track
24
+ model. The probability distribution used is a rate distribution with MTTF of
25
+ 500s and base probability of 0.3. See Roby::FaultInjection in the plugin's API
26
+ documentation for the description of the available probability distributions.
27
+
28
+ Enabling the plugin
29
+ -------------------
30
+
31
+ The plugin must be enabled in the configuration files (i.e. either in
32
+ <tt>config/init.rb</tt> or in one of the robot-specific files) through a call
33
+ to Roby.app.using:
34
+
35
+ {coderay:: ruby}
36
+ Roby.app.using 'fault_injection'
37
+ {coderay}
38
+
39
+ License
40
+ -------
41
+
42
+ This work is licensed under the CeCiLL-B license, which is a free software
43
+ license similar to the BSD license. See License.txt for details.
44
+
@@ -0,0 +1,11 @@
1
+ ---
2
+ title: Standard Plugins
3
+ sort_info: 0
4
+ --- name:content pipeline:tags,markdown,blocks
5
+
6
+ A few generally useful plugins are shipped with the standard Roby installation.
7
+ The following pages describes them and tells you how to enable them in your Roby
8
+ controller.
9
+
10
+
11
+
@@ -0,0 +1,45 @@
1
+ ---
2
+ title: Subsystems <a href="subsystems/index.html">[API]</a>
3
+ routed_title: Subsystems
4
+ sort_info: 0
5
+ --- name:content pipeline:tags,markdown,blocks
6
+
7
+ This is a plugin for the Roby robotic control framework. It allows to generate
8
+ an initial plan in which a set of common subsystems (sensors, localization,
9
+ ...) are already initialized, easing later the writing and management of the
10
+ planning methods for other, more dynamical actions.
11
+
12
+ Usage
13
+ -----
14
+
15
+ A set of services can be defined on <tt>State.services</tt> in the configuration
16
+ files like this:
17
+
18
+ {coderay:: ruby}
19
+ State.services.localization = 'pom'
20
+ State.services.camera = 'cam'
21
+ {coderay}
22
+
23
+ Then, at controller initialization and before the controller file is actually
24
+ loaded, the corresponding planning methods are called on MainPlanner to generate
25
+ a plan in which those subsystems are present:
26
+
27
+ {coderay:: ruby}
28
+ planner.localization(:id => 'pom')
29
+ planner.camera(:id => 'cam')
30
+ {coderay}
31
+
32
+ The returned tasks are also started, in order. The controller file gets loaded
33
+ only when the subsystems are ready (i.e. their start events are emitted).
34
+
35
+ Enabling the plugin
36
+ -------------------
37
+
38
+ The plugin must be enabled in the configuration files (i.e. either in
39
+ <tt>config/init.rb</tt> or in one of the robot-specific files) through a call
40
+ to Roby.app.using:
41
+
42
+ {coderay:: ruby}
43
+ Roby.app.using 'subsystems'
44
+ {coderay}
45
+
@@ -0,0 +1,89 @@
1
+ ---
2
+ title: TaskStructure::Dependency
3
+ sort_info: 100
4
+ --- name:content pipeline:tags,rdoc,blocks
5
+
6
+ == Semantics
7
+ The dependency relation is is a <i>dependency</i> relation. If task t1 is a
8
+ parent of task t2 in that relation, it means that the successful execution of
9
+ t1 requires the successful execution of t2.
10
+
11
+ To add a new dependency relation between two tasks +t1+ and +t2+, simply do
12
+ t1.depends_on t2
13
+
14
+ More specifically, the dependency relation expresses that +t2+ must achieve a
15
+ specific thing for +t1+. In Roby, such an achievement is of course defined by a
16
+ set of events.
17
+
18
+ So, in Roby terms, _depends\_on_ specifies that +t2+ should achieve a specific
19
+ thing for +t1+. By default, that achievement is the _success_ of the child task.
20
+ That can be changed through the +:success+ option of _depends\_on_. By default,
21
+ that set is <tt>:success</tt> (i.e. +t1+ requires a successful execution of
22
+ +t2+). As another example, the following
23
+ t1.depends_on t2, :success => [:updated]
24
+
25
+ specifies that +t1+ needs +t2+ to emit its _updated_ event at least once. The
26
+ default is obviously equivalent to
27
+ t1.depends_on t2, :success => [:success]
28
+
29
+ A different constraint that can be specified is that some events <b>should
30
+ not</b> be emitted. That is specified through the +:failure+ option. For
31
+ instance, if it is required that +t2+ does not stop while +t1+ is running, do
32
+ t1.depends_on t2, :success => [], :failure => [:stop]
33
+
34
+ Note that it does _not_ specify that +t2+ should run as long as +t1+ runs: to do
35
+ that, you would need to specify that +t2+ must be started when +t1+ is started
36
+ with (for instance):
37
+ t1.on :start, t2, :start
38
+
39
+ The relation constraint is one-shot: if any of the success events have already
40
+ been emitted, then the failure events do not matter anymore. For instance, if
41
+ the following relation is added:
42
+ t1.depends_on t2, :success => [:updated], :failure => [:success]
43
+
44
+ Then as soon as +:updated+ is emitted, the emission of +:success+ is not a
45
+ failure anymore. In a same way, as soon as +:success+ is emitted then the
46
+ emission of +:updated+ will not be considered as a success anymore.
47
+
48
+ == Manipulation
49
+ A dependency relation is added with the #depends_on call. Apart from the
50
+ +:success+ and +:failure+ options described above, one other option is
51
+ available: the +:remove_when_done+ option. If set to true, as for instance
52
+ t1.depends_on t2, :remove_when_done => true
53
+
54
+ then the relation is automatically removed as soon as it is not useful anymore
55
+ (i.e. one of the success events is emitted).
56
+
57
+ A dependency relation is removed with #remove_child
58
+ t1.remove_child t2
59
+
60
+ Children are enumerated with
61
+ t1.each_child { |t2, options| ... }
62
+ t1.children => enumerator
63
+
64
+ and parents with
65
+ t2.each_parent { |t1| ... }
66
+ t2.parents => enumerator
67
+
68
+ Moreover, dependency relationship between two tasks can be tested with the
69
+ following predicates:
70
+ t2.depended_upon_by?(t1)
71
+ returns true if t2 is a dependency of t1: t2 is a direct child of t1.
72
+ t1.depends_on?(t2)
73
+ returns true if t1 depends on t2 in one way or the other, i.e. that t2 is a
74
+ child or a grandchild or a grand-grandchild or ... of t1.
75
+ t1.depends_on?(t2, false)
76
+ returns true if t1 directly depends on t2: t1 is a direct parent of t2.
77
+
78
+ == Errors
79
+
80
+ The two types of errors that can occur in the context of a dependency relation
81
+ are:
82
+ * no success event will ever be emitted (see event
83
+ unreachability:"/objects/events")
84
+ * one of the failure events is emitted
85
+
86
+ In both cases, a {rdoc_class: ChildFailedError} exception is generated. In the
87
+ first case, the failure point is the success event generator that is
88
+ unreachable. In the second case, it is the event that triggered the failure.
89
+
@@ -0,0 +1,12 @@
1
+ ---
2
+ title: Task and Event Relations
3
+ sort_info: 0
4
+ --- name:content pipeline:tags,markdown,blocks
5
+
6
+ This section is a reference for the task and event relations. As you should
7
+ already know now, these relations are used to build the plans that are executed
8
+ by Roby.
9
+
10
+ Look at the main menu on the right, and pick the relation you more information
11
+ on !
12
+
@@ -0,0 +1,24 @@
1
+ #! /bin/sh
2
+
3
+ PAGES_BRANCH=gh-pages
4
+ DOC_DIR=doc/html
5
+
6
+ set -e
7
+
8
+ git reset -q HEAD
9
+
10
+ # Create the tree object
11
+ git add -f $DOC_DIR
12
+ tree=$(git write-tree --prefix=$DOC_DIR)
13
+
14
+ echo "resetting the $PAGES_BRANCH branch"
15
+ commit=$(echo $msg | git commit-tree $tree)
16
+
17
+ if test -n "$commit"; then
18
+ # And finally update the tip of the branch
19
+ git update-ref "refs/heads/$PAGES_BRANCH" "$commit"
20
+ fi
21
+
22
+ git reset -q HEAD
23
+ git push github +$PAGES_BRANCH:$PAGES_BRANCH
24
+
@@ -160,16 +160,16 @@ the application and wait for the "done initialization" line.
160
160
  0
161
161
  0
162
162
 
163
- Now, start a shell and wait its prompt.
163
+ Now, leave the controller running and start a shell in another console. Wait its prompt.
164
164
 
165
165
  $ scripts/shell
166
166
  >>
167
167
 
168
- Let's now check that the <tt>move</tt> action does exist
168
+ The <tt>move</tt> action does exist
169
169
  >> actions
170
170
  => [move]
171
171
 
172
- ... and start the move
172
+ And can be started ...
173
173
  >> m = move! :speed => 0.2
174
174
  => GoForward{speed => 0.2}:0x4886b248[]
175
175
 
@@ -79,6 +79,26 @@ VALUE graph_each_vertex(VALUE self)
79
79
  return self;
80
80
  }
81
81
 
82
+ /* call-seq:
83
+ * graph.size => vertex_count
84
+ *
85
+ * Returns the number of vertices in +graph+
86
+ */
87
+ static
88
+ VALUE graph_size(VALUE self)
89
+ {
90
+ RubyGraph& graph = graph_wrapped(self);
91
+
92
+ vertex_iterator begin, end;
93
+ tie(begin, end) = vertices(graph);
94
+
95
+ size_t count = 0;
96
+ for (vertex_iterator it = begin; it != end; ++it)
97
+ ++count;
98
+ return UINT2NUM(count);
99
+ }
100
+
101
+
82
102
  /*
83
103
  * call-seq:
84
104
  * graph.insert(vertex) => graph
@@ -122,6 +142,30 @@ VALUE graph_remove(VALUE self, VALUE vertex)
122
142
  return self;
123
143
  }
124
144
 
145
+ /*
146
+ * call-seq: graph.clear => graph
147
+ *
148
+ * Removes from graph all vertices that are in graph
149
+ */
150
+ static
151
+ VALUE graph_clear(VALUE self)
152
+ {
153
+ RubyGraph& graph = graph_wrapped(self);
154
+
155
+ vertex_iterator begin, end;
156
+ tie(begin, end) = vertices(graph);
157
+ for (vertex_iterator it = begin; it != end; ++it)
158
+ {
159
+ VALUE vertex_value = graph[*it];
160
+ graph_map& vertex_graphs = vertex_descriptor_map(vertex_value);
161
+
162
+ graph_map::iterator it = vertex_graphs.find(self);
163
+ vertex_graphs.erase(it);
164
+ }
165
+ graph.clear();
166
+ return self;
167
+ }
168
+
125
169
  /*
126
170
  * call-seq:
127
171
  * graph.include?(vertex) => true of false
@@ -500,6 +544,7 @@ extern "C" void Init_roby_bgl()
500
544
  rb_define_alloc_func(bglGraph, graph_alloc);
501
545
 
502
546
  // Functions to manipulate BGL::Vertex objects in Graphs
547
+ rb_define_method(bglGraph, "size", RUBY_METHOD_FUNC(graph_size), 0);
503
548
  rb_define_method(bglGraph, "insert", RUBY_METHOD_FUNC(graph_insert), 1);
504
549
  rb_define_method(bglGraph, "remove", RUBY_METHOD_FUNC(graph_remove), 1);
505
550
  rb_define_method(bglGraph, "include?", RUBY_METHOD_FUNC(graph_include_p), 1);
@@ -508,6 +553,7 @@ extern "C" void Init_roby_bgl()
508
553
  rb_define_method(bglGraph, "linked?", RUBY_METHOD_FUNC(graph_linked_p), 2);
509
554
  rb_define_method(bglGraph, "each_vertex", RUBY_METHOD_FUNC(graph_each_vertex), 0);
510
555
  rb_define_method(bglGraph, "each_edge", RUBY_METHOD_FUNC(graph_each_edge), 0);
556
+ rb_define_method(bglGraph, "clear", RUBY_METHOD_FUNC(graph_clear), 0);
511
557
 
512
558
  bglVertex = rb_define_module_under(bglModule, "Vertex");
513
559
  rb_define_method(bglVertex, "related_vertex?", RUBY_METHOD_FUNC(vertex_related_p), -1);