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.
Files changed (240) hide show
  1. data/.gitignore +29 -0
  2. data/History.txt +4 -0
  3. data/License-fr.txt +519 -0
  4. data/License.txt +515 -0
  5. data/Manifest.txt +245 -0
  6. data/NOTES +4 -0
  7. data/README.txt +163 -0
  8. data/Rakefile +161 -0
  9. data/TODO.txt +146 -0
  10. data/app/README.txt +24 -0
  11. data/app/Rakefile +8 -0
  12. data/app/config/ROBOT.rb +5 -0
  13. data/app/config/app.yml +91 -0
  14. data/app/config/init.rb +7 -0
  15. data/app/config/roby.yml +3 -0
  16. data/app/controllers/.gitattributes +0 -0
  17. data/app/controllers/ROBOT.rb +2 -0
  18. data/app/data/.gitattributes +0 -0
  19. data/app/planners/ROBOT/main.rb +6 -0
  20. data/app/planners/main.rb +5 -0
  21. data/app/scripts/distributed +3 -0
  22. data/app/scripts/generate/bookmarks +3 -0
  23. data/app/scripts/replay +3 -0
  24. data/app/scripts/results +3 -0
  25. data/app/scripts/run +3 -0
  26. data/app/scripts/server +3 -0
  27. data/app/scripts/shell +3 -0
  28. data/app/scripts/test +3 -0
  29. data/app/tasks/.gitattributes +0 -0
  30. data/app/tasks/ROBOT/.gitattributes +0 -0
  31. data/bin/roby +210 -0
  32. data/bin/roby-log +168 -0
  33. data/bin/roby-shell +25 -0
  34. data/doc/images/event_generalization.png +0 -0
  35. data/doc/images/exception_propagation_1.png +0 -0
  36. data/doc/images/exception_propagation_2.png +0 -0
  37. data/doc/images/exception_propagation_3.png +0 -0
  38. data/doc/images/exception_propagation_4.png +0 -0
  39. data/doc/images/exception_propagation_5.png +0 -0
  40. data/doc/images/replay_handler_error.png +0 -0
  41. data/doc/images/replay_handler_error_0.png +0 -0
  42. data/doc/images/replay_handler_error_1.png +0 -0
  43. data/doc/images/roby_cycle_overview.png +0 -0
  44. data/doc/images/roby_replay_02.png +0 -0
  45. data/doc/images/roby_replay_03.png +0 -0
  46. data/doc/images/roby_replay_04.png +0 -0
  47. data/doc/images/roby_replay_event_representation.png +0 -0
  48. data/doc/images/roby_replay_first_state.png +0 -0
  49. data/doc/images/roby_replay_relations.png +0 -0
  50. data/doc/images/roby_replay_startup.png +0 -0
  51. data/doc/images/task_event_generalization.png +0 -0
  52. data/doc/papers.rdoc +11 -0
  53. data/doc/styles/allison.css +314 -0
  54. data/doc/styles/allison.js +316 -0
  55. data/doc/styles/allison.rb +276 -0
  56. data/doc/styles/jamis.rb +593 -0
  57. data/doc/tutorials/01-GettingStarted.rdoc +86 -0
  58. data/doc/tutorials/02-GoForward.rdoc +220 -0
  59. data/doc/tutorials/03-PlannedPath.rdoc +268 -0
  60. data/doc/tutorials/04-EventPropagation.rdoc +236 -0
  61. data/doc/tutorials/05-ErrorHandling.rdoc +319 -0
  62. data/doc/tutorials/06-Overview.rdoc +40 -0
  63. data/doc/videos.rdoc +69 -0
  64. data/ext/droby/dump.cc +175 -0
  65. data/ext/droby/extconf.rb +3 -0
  66. data/ext/graph/algorithm.cc +746 -0
  67. data/ext/graph/extconf.rb +7 -0
  68. data/ext/graph/graph.cc +529 -0
  69. data/ext/graph/graph.hh +183 -0
  70. data/ext/graph/iterator_sequence.hh +102 -0
  71. data/ext/graph/undirected_dfs.hh +226 -0
  72. data/ext/graph/undirected_graph.hh +421 -0
  73. data/lib/roby.rb +41 -0
  74. data/lib/roby/app.rb +870 -0
  75. data/lib/roby/app/rake.rb +56 -0
  76. data/lib/roby/app/run.rb +14 -0
  77. data/lib/roby/app/scripts/distributed.rb +13 -0
  78. data/lib/roby/app/scripts/generate/bookmarks.rb +162 -0
  79. data/lib/roby/app/scripts/replay.rb +31 -0
  80. data/lib/roby/app/scripts/results.rb +15 -0
  81. data/lib/roby/app/scripts/run.rb +26 -0
  82. data/lib/roby/app/scripts/server.rb +18 -0
  83. data/lib/roby/app/scripts/shell.rb +88 -0
  84. data/lib/roby/app/scripts/test.rb +40 -0
  85. data/lib/roby/basic_object.rb +151 -0
  86. data/lib/roby/config.rb +5 -0
  87. data/lib/roby/control.rb +747 -0
  88. data/lib/roby/decision_control.rb +17 -0
  89. data/lib/roby/distributed.rb +32 -0
  90. data/lib/roby/distributed/base.rb +440 -0
  91. data/lib/roby/distributed/communication.rb +871 -0
  92. data/lib/roby/distributed/connection_space.rb +592 -0
  93. data/lib/roby/distributed/distributed_object.rb +206 -0
  94. data/lib/roby/distributed/drb.rb +62 -0
  95. data/lib/roby/distributed/notifications.rb +539 -0
  96. data/lib/roby/distributed/peer.rb +550 -0
  97. data/lib/roby/distributed/protocol.rb +529 -0
  98. data/lib/roby/distributed/proxy.rb +343 -0
  99. data/lib/roby/distributed/subscription.rb +311 -0
  100. data/lib/roby/distributed/transaction.rb +498 -0
  101. data/lib/roby/event.rb +897 -0
  102. data/lib/roby/exceptions.rb +234 -0
  103. data/lib/roby/executives/simple.rb +30 -0
  104. data/lib/roby/graph.rb +166 -0
  105. data/lib/roby/interface.rb +390 -0
  106. data/lib/roby/log.rb +3 -0
  107. data/lib/roby/log/chronicle.rb +303 -0
  108. data/lib/roby/log/console.rb +72 -0
  109. data/lib/roby/log/data_stream.rb +197 -0
  110. data/lib/roby/log/dot.rb +279 -0
  111. data/lib/roby/log/event_stream.rb +151 -0
  112. data/lib/roby/log/file.rb +340 -0
  113. data/lib/roby/log/gui/basic_display.ui +83 -0
  114. data/lib/roby/log/gui/chronicle.rb +26 -0
  115. data/lib/roby/log/gui/chronicle_view.rb +40 -0
  116. data/lib/roby/log/gui/chronicle_view.ui +70 -0
  117. data/lib/roby/log/gui/data_displays.rb +172 -0
  118. data/lib/roby/log/gui/data_displays.ui +155 -0
  119. data/lib/roby/log/gui/notifications.rb +26 -0
  120. data/lib/roby/log/gui/relations.rb +248 -0
  121. data/lib/roby/log/gui/relations.ui +123 -0
  122. data/lib/roby/log/gui/relations_view.rb +185 -0
  123. data/lib/roby/log/gui/relations_view.ui +149 -0
  124. data/lib/roby/log/gui/replay.rb +327 -0
  125. data/lib/roby/log/gui/replay_controls.rb +200 -0
  126. data/lib/roby/log/gui/replay_controls.ui +259 -0
  127. data/lib/roby/log/gui/runtime.rb +130 -0
  128. data/lib/roby/log/hooks.rb +185 -0
  129. data/lib/roby/log/logger.rb +202 -0
  130. data/lib/roby/log/notifications.rb +244 -0
  131. data/lib/roby/log/plan_rebuilder.rb +470 -0
  132. data/lib/roby/log/relations.rb +1056 -0
  133. data/lib/roby/log/server.rb +550 -0
  134. data/lib/roby/log/sqlite.rb +47 -0
  135. data/lib/roby/log/timings.rb +164 -0
  136. data/lib/roby/plan-object.rb +247 -0
  137. data/lib/roby/plan.rb +762 -0
  138. data/lib/roby/planning.rb +13 -0
  139. data/lib/roby/planning/loops.rb +302 -0
  140. data/lib/roby/planning/model.rb +906 -0
  141. data/lib/roby/planning/task.rb +151 -0
  142. data/lib/roby/propagation.rb +562 -0
  143. data/lib/roby/query.rb +619 -0
  144. data/lib/roby/relations.rb +583 -0
  145. data/lib/roby/relations/conflicts.rb +70 -0
  146. data/lib/roby/relations/ensured.rb +20 -0
  147. data/lib/roby/relations/error_handling.rb +23 -0
  148. data/lib/roby/relations/events.rb +9 -0
  149. data/lib/roby/relations/executed_by.rb +193 -0
  150. data/lib/roby/relations/hierarchy.rb +239 -0
  151. data/lib/roby/relations/influence.rb +10 -0
  152. data/lib/roby/relations/planned_by.rb +63 -0
  153. data/lib/roby/robot.rb +7 -0
  154. data/lib/roby/standard_errors.rb +218 -0
  155. data/lib/roby/state.rb +5 -0
  156. data/lib/roby/state/events.rb +221 -0
  157. data/lib/roby/state/information.rb +55 -0
  158. data/lib/roby/state/pos.rb +110 -0
  159. data/lib/roby/state/shapes.rb +32 -0
  160. data/lib/roby/state/state.rb +353 -0
  161. data/lib/roby/support.rb +92 -0
  162. data/lib/roby/task-operations.rb +182 -0
  163. data/lib/roby/task.rb +1618 -0
  164. data/lib/roby/test/common.rb +399 -0
  165. data/lib/roby/test/distributed.rb +214 -0
  166. data/lib/roby/test/tasks/empty_task.rb +9 -0
  167. data/lib/roby/test/tasks/goto.rb +36 -0
  168. data/lib/roby/test/tasks/simple_task.rb +23 -0
  169. data/lib/roby/test/testcase.rb +519 -0
  170. data/lib/roby/test/tools.rb +160 -0
  171. data/lib/roby/thread_task.rb +87 -0
  172. data/lib/roby/transactions.rb +462 -0
  173. data/lib/roby/transactions/proxy.rb +292 -0
  174. data/lib/roby/transactions/updates.rb +139 -0
  175. data/plugins/fault_injection/History.txt +4 -0
  176. data/plugins/fault_injection/README.txt +37 -0
  177. data/plugins/fault_injection/Rakefile +18 -0
  178. data/plugins/fault_injection/TODO.txt +0 -0
  179. data/plugins/fault_injection/app.rb +52 -0
  180. data/plugins/fault_injection/fault_injection.rb +89 -0
  181. data/plugins/fault_injection/test/test_fault_injection.rb +84 -0
  182. data/plugins/subsystems/README.txt +40 -0
  183. data/plugins/subsystems/Rakefile +18 -0
  184. data/plugins/subsystems/app.rb +171 -0
  185. data/plugins/subsystems/test/app/README +24 -0
  186. data/plugins/subsystems/test/app/Rakefile +8 -0
  187. data/plugins/subsystems/test/app/config/app.yml +71 -0
  188. data/plugins/subsystems/test/app/config/init.rb +9 -0
  189. data/plugins/subsystems/test/app/config/roby.yml +3 -0
  190. data/plugins/subsystems/test/app/planners/main.rb +20 -0
  191. data/plugins/subsystems/test/app/scripts/distributed +3 -0
  192. data/plugins/subsystems/test/app/scripts/replay +3 -0
  193. data/plugins/subsystems/test/app/scripts/results +3 -0
  194. data/plugins/subsystems/test/app/scripts/run +3 -0
  195. data/plugins/subsystems/test/app/scripts/server +3 -0
  196. data/plugins/subsystems/test/app/scripts/shell +3 -0
  197. data/plugins/subsystems/test/app/scripts/test +3 -0
  198. data/plugins/subsystems/test/app/tasks/services.rb +15 -0
  199. data/plugins/subsystems/test/test_subsystems.rb +71 -0
  200. data/test/distributed/test_communication.rb +178 -0
  201. data/test/distributed/test_connection.rb +282 -0
  202. data/test/distributed/test_execution.rb +373 -0
  203. data/test/distributed/test_mixed_plan.rb +341 -0
  204. data/test/distributed/test_plan_notifications.rb +238 -0
  205. data/test/distributed/test_protocol.rb +516 -0
  206. data/test/distributed/test_query.rb +102 -0
  207. data/test/distributed/test_remote_plan.rb +491 -0
  208. data/test/distributed/test_transaction.rb +463 -0
  209. data/test/mockups/tasks.rb +27 -0
  210. data/test/planning/test_loops.rb +380 -0
  211. data/test/planning/test_model.rb +427 -0
  212. data/test/planning/test_task.rb +106 -0
  213. data/test/relations/test_conflicts.rb +42 -0
  214. data/test/relations/test_ensured.rb +38 -0
  215. data/test/relations/test_executed_by.rb +149 -0
  216. data/test/relations/test_hierarchy.rb +158 -0
  217. data/test/relations/test_planned_by.rb +54 -0
  218. data/test/suite_core.rb +24 -0
  219. data/test/suite_distributed.rb +9 -0
  220. data/test/suite_planning.rb +3 -0
  221. data/test/suite_relations.rb +8 -0
  222. data/test/test_bgl.rb +508 -0
  223. data/test/test_control.rb +399 -0
  224. data/test/test_event.rb +894 -0
  225. data/test/test_exceptions.rb +592 -0
  226. data/test/test_interface.rb +37 -0
  227. data/test/test_log.rb +114 -0
  228. data/test/test_log_server.rb +132 -0
  229. data/test/test_plan.rb +584 -0
  230. data/test/test_propagation.rb +210 -0
  231. data/test/test_query.rb +266 -0
  232. data/test/test_relations.rb +180 -0
  233. data/test/test_state.rb +414 -0
  234. data/test/test_support.rb +16 -0
  235. data/test/test_task.rb +938 -0
  236. data/test/test_testcase.rb +122 -0
  237. data/test/test_thread_task.rb +73 -0
  238. data/test/test_transactions.rb +569 -0
  239. data/test/test_transactions_proxy.rb +198 -0
  240. metadata +570 -0
@@ -0,0 +1,56 @@
1
+ require 'roby/support'
2
+
3
+ module Roby
4
+ # This module contains some tools used in the Rakefile of both Roby core
5
+ # and plugins
6
+ module Rake
7
+ extend Logger::Hierarchy
8
+ extend Logger::Forward
9
+
10
+ # Returns the rdoc template path the documentation
11
+ # generation should be using in Rakefile
12
+ #
13
+ # Two non-standard templates are provided:
14
+ # allison[http://blog.evanweaver.com/files/doc/fauna/allison/files/README.html]
15
+ # and jamis[http://weblog.jamisbuck.org/2005/4/8/rdoc-template]. The
16
+ # default is jamis. Allison is nicer, but the javascript-based indexes
17
+ # are slow given the count of classes and methods there is in Roby.
18
+ def self.rdoc_template
19
+ if ENV['ROBY_RDOC_TEMPLATE']
20
+ if ENV['ROBY_RDOC_TEMPLATE'] == 'jamis'
21
+ Roby::Rake.info "using in-source jamis template"
22
+ File.expand_path('doc/styles/jamis', ROBY_ROOT_DIR)
23
+ elsif ENV['ROBY_RDOC_TEMPLATE'] == 'allison'
24
+ Roby::Rake.info "using in-source allison template"
25
+ File.expand_path('doc/styles/allison', ROBY_ROOT_DIR)
26
+ else
27
+ Roby::Rake.info "using the #{ENV['ROBY_RDOC_TEMPLATE']} template"
28
+ ENV['ROBY_RDOC_TEMPLATE']
29
+ end
30
+ else
31
+ File.expand_path('doc/styles/jamis', ROBY_ROOT_DIR)
32
+ end
33
+ end
34
+
35
+ # Invoke the given target in all plugins found in plugins/ that define it
36
+ def self.invoke_plugin_target(target)
37
+ ENV['ROBY_ROOT_DIR'] = ROBY_ROOT_DIR
38
+ Dir.new('plugins').each do |plugin_dir|
39
+ next if plugin_dir =~ /^\.{1,2}$/
40
+
41
+ plugin_dir = File.join('plugins', plugin_dir)
42
+ if File.file? File.join(plugin_dir, 'Rakefile')
43
+ Dir.chdir(plugin_dir) do
44
+ task_list = `rake --tasks`.split("\n")
45
+ if !task_list.grep(/^rake #{target}(\s|$)/).empty?
46
+ if !system 'rake', target
47
+ raise "failed to call rake target #{target} in #{plugin_dir}"
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+
@@ -0,0 +1,14 @@
1
+ require 'roby/app'
2
+
3
+ app = Roby.app
4
+ require 'optparse'
5
+ parser = OptionParser.new do |opt|
6
+ opt.on("--sim", "run in simulation mode") do
7
+ app.simulation
8
+ end
9
+ opt.on("--single", "run in mono-robot mode") do
10
+ app.single
11
+ end
12
+ end
13
+ parser.parse!(ARGV)
14
+
@@ -0,0 +1,13 @@
1
+ require 'roby/distributed/connection_space'
2
+ require 'roby/distributed/protocol'
3
+
4
+ config = Roby.app
5
+ config.setup
6
+ begin
7
+ config.start_distributed
8
+ sleep
9
+ rescue Interrupt
10
+ ensure
11
+ config.stop_distributed
12
+ end
13
+
@@ -0,0 +1,162 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require 'roby/log/event_stream'
4
+ STDOUT.sync = true
5
+
6
+ class Roby::Log::EventMatcher
7
+ attr_reader :remote_ids
8
+ attr_reader :predicate_id
9
+ attr_reader :notifications
10
+ def initialize
11
+ @remote_ids = Hash.new
12
+ @notifications = Hash.new
13
+ @predicate_id = 0
14
+ end
15
+
16
+ def local_object(remote_id)
17
+ if remote_id.kind_of?(Roby::Distributed::RemoteID)
18
+ unless obj = remote_ids[remote_id]
19
+ raise "no object for #{remote_id}: #{remote_ids.keys}"
20
+ end
21
+ obj
22
+ else
23
+ remote_id
24
+ end
25
+ end
26
+
27
+ def filter(log)
28
+ while log.has_sample?
29
+ log.read_and_decode.each_slice(4) do |m, sec, usec, args|
30
+ event(m, sec, usec, args)
31
+ end
32
+ end
33
+ end
34
+
35
+ def event(m, sec, usec, args)
36
+ if m == :discovered_tasks || m == :discovered_events
37
+ objects = args[1]
38
+ for object in objects
39
+ for remote_id in object.remote_siblings.values
40
+ remote_ids[remote_id] = object
41
+ end
42
+ end
43
+
44
+ elsif m == :finalized_task || m == :finalized_event
45
+ object = args[1]
46
+ remote_ids.delete(object)
47
+ end
48
+
49
+ time = nil
50
+ if predicate_set = notifications[m]
51
+ for p, callback in predicate_set
52
+ if p.call(args)
53
+ time ||= Time.at(sec, usec)
54
+ callback.call(time, args)
55
+ end
56
+ end
57
+ end
58
+ end
59
+
60
+ def parse(expr, &block)
61
+ case expr
62
+ when /^(\w+)\((.*)\)$/
63
+ method = :generator_fired
64
+ task_model = Regexp.new($2)
65
+ symbol = $1.to_sym
66
+ predicate = lambda do |args|
67
+ generator = local_object(args[0])
68
+ if generator.respond_to?(:task) && generator.symbol == symbol
69
+ task = local_object(generator.task)
70
+ Regexp.new(task_model) === local_object(task).model.ancestors[0][0]
71
+ end
72
+ end
73
+ end
74
+
75
+ if predicate
76
+ notifications[method] ||= Array.new
77
+ notifications[method] << [predicate, block]
78
+ end
79
+ end
80
+ end
81
+
82
+ config_path = ARGV[0]
83
+ event_path = ARGV[1]
84
+ unless config_path && event_path
85
+ STDERR.puts <<-EOU
86
+ Usage: scripts/generate/bookmarks config.yml event_set
87
+
88
+ This script generates a bookmark file suitable for roby-log replay based on a
89
+ log file and on a configuration file. The configuration file format is as
90
+ follows:
91
+
92
+ event_name:
93
+ - start_point
94
+ - end_point
95
+
96
+ where start_point and end_point are matching expressions. The following
97
+ expressions are recognized:
98
+
99
+ start(task_model)
100
+ ready(task_model)
101
+ stop(task_model
102
+
103
+ they trigger when, respectively, a task instance of the specified model is
104
+ started, its ready event has emitted and it stopped.
105
+
106
+ For instance, to get a 'localization_initialized' bookmark for a Localization
107
+ task, you would write the following configuration file:
108
+
109
+ localization_initialized:
110
+ - start(Localization)
111
+ - ready(Localization)
112
+
113
+ EOU
114
+
115
+ exit(1)
116
+
117
+ end
118
+
119
+ # Reverse the config file from a 'bookmark_name => event' into a 'event' =>
120
+ # 'bookmark_name'
121
+ config = YAML.load(File.open(ARGV[0]))
122
+ bookmarks = Hash.new
123
+
124
+ filter = Roby::Log::EventMatcher.new
125
+ config.each do |name, (start_point, end_point)|
126
+ bookmarks[name] = []
127
+ filter.parse(start_point) do |time, args|
128
+ STDERR.puts "#{time.to_hms} starting point for #{name}"
129
+ bookmarks[name] << [time]
130
+ end
131
+ filter.parse(end_point) do |time, args|
132
+ if bookmarks[name].last && bookmarks[name].last[0] && !bookmarks[name].last[1]
133
+ STDERR.puts "#{time.to_hms} end point for #{name}"
134
+ bookmarks[name].last[1] = time
135
+ end
136
+ end
137
+ end
138
+
139
+ log = Roby::Log::EventStream.open(ARGV[1])
140
+ filter.filter(log)
141
+
142
+ bookmark_data = Hash.new
143
+ bookmarks.each do |name, ranges|
144
+ if ranges.size == 1
145
+ bookmark_data[name] = ranges[0].map { |t| t }
146
+ else
147
+ ranges.each_with_index do |r, i|
148
+ bookmark_data["#{name}-#{i}"] = r.map { |t| t }
149
+ end
150
+ end
151
+ end
152
+
153
+ bookmark_data =
154
+
155
+ bookmark_data.sort_by { |n, r| r[0] }.
156
+ each do |name, range|
157
+ puts "#{name}:"
158
+ range.each do |time|
159
+ puts " - \"#{time.to_hms}\""
160
+ end
161
+ end
162
+
@@ -0,0 +1,31 @@
1
+ require 'roby'
2
+ require 'roby/log/gui/replay'
3
+ app = Qt::Application.new(ARGV)
4
+ main = Replay.setup(ARGV)
5
+
6
+ if ARGV.empty?
7
+ Roby.app.setup
8
+
9
+ streams = Roby.app.data_streams(Roby.app.log_dir)
10
+ streams.each do |stream|
11
+ stream.open
12
+ main.add_stream(stream)
13
+ end
14
+ else
15
+ ARGV.each do |file|
16
+ if streams = Roby.app.data_source([file])
17
+ streams.each { |s| s.open }
18
+ main.add_stream(streams)
19
+ else
20
+ STDERR.puts "WARN: unknown file type #{file}"
21
+ end
22
+ end
23
+ end
24
+
25
+ begin
26
+ main.show
27
+ app.exec
28
+ rescue
29
+ STDERR.puts $!.full_message
30
+ end
31
+
@@ -0,0 +1,15 @@
1
+ require 'roby'
2
+ Roby.app.setup
3
+ app = Roby.app
4
+
5
+ # Check there are actually files in the log/ directory
6
+ if Dir.enum_for(:glob, File.join(app.log_dir, "*")).to_a.empty?
7
+ puts "no files in #{app.log_dir}, nothing to do"
8
+ exit 0
9
+ end
10
+
11
+ user_path = ARGV.shift
12
+ final_path = Roby::Application.unique_dirname(Roby.app.results_dir, user_path)
13
+ puts "moving #{app.log_dir} to #{final_path}"
14
+ FileUtils.mv app.log_dir, final_path
15
+
@@ -0,0 +1,26 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'run')
2
+ app = Roby.app
3
+
4
+ robot_name = ARGV.shift
5
+ app.robot robot_name, (ARGV.shift || robot_name)
6
+ app.setup
7
+ begin
8
+ app.run do
9
+ # Load the controller
10
+ include Roby
11
+ Roby.execute do
12
+ begin
13
+ controller_file = File.join(APP_DIR, "controllers", "#{app.robot_name}.rb")
14
+ if File.readable?(controller_file)
15
+ Robot.info "loading controller file #{controller_file}"
16
+ load controller_file
17
+ end
18
+ Robot.info "done initialization"
19
+ rescue Interrupt
20
+ end
21
+ end
22
+ end
23
+ rescue Interrupt
24
+ Roby.fatal "interrupted"
25
+ end
26
+
@@ -0,0 +1,18 @@
1
+ require 'roby/log/server'
2
+
3
+ app = Roby.app
4
+ app.setup
5
+ DRb.start_service "druby://:0"
6
+
7
+ begin
8
+ app.start_server
9
+
10
+ Roby::Log::Server.info "ready"
11
+ sleep
12
+ rescue Interrupt
13
+ ensure
14
+ Roby::Log::Server.info "quitting"
15
+ app.stop_server
16
+ end
17
+ Roby::Log::Server.info "quit"
18
+
@@ -0,0 +1,88 @@
1
+ require 'roby'
2
+ require 'roby/app'
3
+ require 'roby/distributed'
4
+ require 'roby/distributed/protocol'
5
+ require 'optparse'
6
+
7
+ remote_url = nil
8
+ opt = OptionParser.new do |opt|
9
+ opt.on('--host URL', String, "sets the host to connect to") do |url|
10
+ remote_url = url
11
+ end
12
+ end
13
+ opt.parse! ARGV
14
+
15
+ app = Roby.app
16
+ app.shell
17
+ app.single
18
+
19
+ robot_name = ARGV.shift
20
+ app.robot robot_name, (ARGV.shift || robot_name)
21
+ app.setup
22
+
23
+ remote_url ||= app.droby['host']
24
+ remote_url ||= 'localhost'
25
+ if remote_url !~ /:\d+$/
26
+ if app.droby['host'] && app.droby['host'] =~ /(:\d+)$/
27
+ remote_url << $1
28
+ else
29
+ remote_url << ":#{Roby::Distributed::DEFAULT_DROBY_PORT}"
30
+ end
31
+ end
32
+
33
+ DRb.start_service
34
+
35
+ require 'irb'
36
+ IRB.setup(nil)
37
+
38
+ control = Roby::RemoteInterface.new(DRbObject.new_with_uri("druby://#{remote_url}"))
39
+
40
+ begin
41
+ # Make control the top-level object
42
+ bind = control.instance_eval { binding }
43
+ ws = IRB::WorkSpace.new(bind)
44
+ irb = IRB::Irb.new(ws)
45
+
46
+ context = irb.context
47
+ def context.evaluate(*args, &block)
48
+ Roby.execute do
49
+ super
50
+ end
51
+ end
52
+ IRB.conf[:MAIN_CONTEXT] = irb.context
53
+
54
+ trap("SIGINT") do
55
+ irb.signal_handle
56
+ end
57
+
58
+ # Create a thread which reads the remote messages and display them if needed
59
+ Thread.new do
60
+ begin
61
+ loop do
62
+ sleep(1)
63
+
64
+ msg = begin
65
+ control.poll_messages
66
+ rescue DRb::DRbConnError
67
+ []
68
+ end
69
+
70
+ if !msg.empty?
71
+ STDERR.puts
72
+ msg.each do |t|
73
+ STDERR.puts "!" + t.split("\n").join("\n!")
74
+ end
75
+ end
76
+ end
77
+ rescue
78
+ STDERR.puts $!.full_message
79
+ ensure
80
+ STDERR.puts "message polling died"
81
+ end
82
+ end
83
+
84
+ catch(:IRB_EXIT) do
85
+ irb.eval_input
86
+ end
87
+ end
88
+
@@ -0,0 +1,40 @@
1
+ require 'roby'
2
+ require 'optparse'
3
+
4
+ testrb_args = []
5
+ parser = OptionParser.new do |opt|
6
+ opt.on("-s", "--sim", "run tests in simulation mode") do |val|
7
+ Roby.app.simulation = val
8
+ end
9
+ opt.on("-k", "--keep-logs", "keep all logs") do |val|
10
+ Roby.app.testing_keep_logs = val
11
+ end
12
+ opt.on("-o", "--overwrite-oldlogs", "if there are logs for the same test case, overwrite them") do |val|
13
+ Roby.app.testing_overwrites_logs = val
14
+ end
15
+ opt.on("-i", "--interactive", "allow user interaction during tests") do |val|
16
+ Roby.app.automatic_testing = false
17
+ end
18
+ opt.on("-n", "--name NAME", String, "run tests matching NAME") do |name|
19
+ testrb_args << "-n" << name
20
+ end
21
+ end
22
+ parser.parse! ARGV
23
+ Roby.app.testing = true
24
+ require 'roby/test/testcase'
25
+
26
+ app = Roby.app
27
+ app.setup
28
+
29
+ r = Test::Unit::AutoRunner.new(true)
30
+ r.process_args(ARGV + testrb_args) or
31
+ abort r.options.banner + " tests..."
32
+
33
+ if r.filters.empty?
34
+ r.filters << lambda do |t|
35
+ t.class != Roby::Test::TestCase
36
+ end
37
+ end
38
+
39
+ exit r.run
40
+