roby 0.7 → 0.7.1

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 CHANGED
@@ -2,7 +2,7 @@ Makefile
2
2
  ext/*/*.o
3
3
  ext/*/*.so
4
4
  ext/*/mkmf.log
5
- lib/roby/*.so
5
+ lib/roby_*.so
6
6
  *_ui.rb
7
7
 
8
8
  doc/rdoc
data/History.txt CHANGED
@@ -1,3 +1,12 @@
1
+ === 0.7.1
2
+
3
+ * Fixed extension handling in 'rake setup'. It should work again.
4
+ * Fixed a lack of proper synchronization in operations without an execution
5
+ thread. This led to pile of strange errors in Roby's own test suite, but
6
+ should not have impacted normal operations (where a separate execution thread
7
+ exists)
8
+ * Fixed a potential race condition in PlanningTask
9
+
1
10
  === 0.7
2
11
 
3
12
  * First public release. This release is still not compatible with Ruby 1.9, as
data/README.txt CHANGED
@@ -161,3 +161,6 @@ one[http://github.com/doudou/roby].
161
161
  Once the source is installed, run
162
162
  rake setup
163
163
 
164
+ Define first the BOOST_DIR environment variable to Boost's installation path if
165
+ that path is non-standard.
166
+
data/Rakefile CHANGED
@@ -54,7 +54,7 @@ def build_extension(name, soname = name)
54
54
  raise "cannot set up #{name} extension"
55
55
  end
56
56
  end
57
- FileUtils.ln_sf "../../ext/#{name}/#{soname}.so", "lib/roby/#{soname}.so"
57
+ FileUtils.ln_sf "../ext/#{name}/#{soname}.so", "lib/#{soname}.so"
58
58
  end
59
59
  def clean_extension(name, soname = name)
60
60
  puts "Cleaning ext/#{name}"
@@ -91,8 +91,8 @@ end
91
91
 
92
92
  desc 'generate and build all the necessary files'
93
93
  task :setup => :uic do
94
- build_extension 'droby'
95
- build_extension 'graph', 'bgl'
94
+ build_extension 'droby', 'roby_marshalling'
95
+ build_extension 'graph', 'roby_bgl'
96
96
  end
97
97
 
98
98
  desc 'remove all generated files'
File without changes
File without changes
data/app/scripts/replay CHANGED
File without changes
data/app/scripts/results CHANGED
File without changes
data/app/scripts/run CHANGED
File without changes
data/app/scripts/server CHANGED
File without changes
data/app/scripts/shell CHANGED
File without changes
data/app/scripts/test CHANGED
File without changes
data/bin/roby CHANGED
File without changes
data/bin/roby-log CHANGED
File without changes
data/bin/roby-shell CHANGED
File without changes
data/lib/roby/config.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Roby
2
- VERSION = '0.7'
2
+ VERSION = '0.7.1'
3
3
  ROBY_LIB_DIR = File.expand_path( File.join(File.dirname(__FILE__), '..') )
4
4
  ROBY_ROOT_DIR = File.expand_path( File.join(ROBY_LIB_DIR, '..') )
5
5
  end
data/lib/roby/control.rb CHANGED
@@ -115,7 +115,7 @@ module Roby
115
115
  # it has finished. The return value is the value returned by the block
116
116
  def execute
117
117
  if Roby.inside_control?
118
- return yield
118
+ return Roby::Control.synchronize { yield }
119
119
  end
120
120
 
121
121
  cv = condition_variable
@@ -196,7 +196,7 @@ module Roby
196
196
  proxy_objects.each_key { |o| all_objects << o }
197
197
  Distributed.update(self) do
198
198
  Distributed.update_all(all_objects) do
199
- super()
199
+ super() { yield if block_given? }
200
200
  end
201
201
  end
202
202
  end
data/lib/roby/event.rb CHANGED
@@ -204,17 +204,18 @@ module Roby
204
204
  if Propagation.gathering?
205
205
  Propagation.add_event_propagation(false, Propagation.sources, self, (context unless context.empty?), nil)
206
206
  else
207
- errors = Propagation.propagate_events do |initial_set|
208
- Propagation.add_event_propagation(false, nil, self, (context unless context.empty?), nil)
209
- end
210
- if errors.size == 1
211
- e = errors.first.exception
212
- raise e, e.message, e.backtrace
213
- elsif !errors.empty?
214
- for e in errors
215
- STDERR.puts e.exception.full_message
207
+ Roby::Control.synchronize do
208
+ errors = Propagation.propagate_events do |initial_set|
209
+ Propagation.add_event_propagation(false, nil, self, (context unless context.empty?), nil)
210
+ end
211
+ if errors.size == 1
212
+ e = errors.first.exception
213
+ raise e, e.message, e.backtrace
214
+ elsif !errors.empty?
215
+ for e in errors
216
+ STDERR.puts e.exception.full_message
217
+ end
216
218
  end
217
- raise "multiple exceptions"
218
219
  end
219
220
  end
220
221
  end
@@ -461,17 +462,18 @@ module Roby
461
462
  if Propagation.gathering?
462
463
  Propagation.add_event_propagation(true, Propagation.sources, self, (context unless context.empty?), nil)
463
464
  else
464
- errors = Propagation.propagate_events do |initial_set|
465
- Propagation.add_event_propagation(true, Propagation.sources, self, (context unless context.empty?), nil)
466
- end
467
- if errors.size == 1
468
- e = errors.first.exception
469
- raise e, e.message, e.backtrace
470
- elsif !errors.empty?
471
- for e in errors
472
- STDERR.puts e.full_message
465
+ Roby::Control.synchronize do
466
+ errors = Propagation.propagate_events do |initial_set|
467
+ Propagation.add_event_propagation(true, Propagation.sources, self, (context unless context.empty?), nil)
468
+ end
469
+ if errors.size == 1
470
+ e = errors.first.exception
471
+ raise e, e.message, e.backtrace
472
+ elsif !errors.empty?
473
+ for e in errors
474
+ STDERR.puts e.full_message
475
+ end
473
476
  end
474
- raise "multiple exceptions"
475
477
  end
476
478
  end
477
479
  end
@@ -47,14 +47,16 @@ module Roby
47
47
  end
48
48
 
49
49
  def planned_task
50
- task = planned_tasks.find { true }
51
- if !task && pending?
50
+ if success? || result
51
+ result
52
+ elsif task = planned_tasks.find { true }
53
+ task
54
+ elsif pending?
52
55
  task = planned_model.new
53
56
  task.planned_by self
54
57
  task.executable = false
58
+ task
55
59
  end
56
-
57
- task
58
60
  end
59
61
 
60
62
  # The thread that is running the planner
@@ -103,9 +105,9 @@ module Roby
103
105
  # If the transaction is distributed, and is not proposed to all
104
106
  # owners, do it
105
107
  transaction.propose
106
- transaction.commit_transaction
107
-
108
- @result = result_task
108
+ transaction.commit_transaction do
109
+ @result = result_task
110
+ end
109
111
  end
110
112
 
111
113
  # Polls for the planning thread end
@@ -405,6 +405,8 @@ module Roby
405
405
  committed_transaction
406
406
  plan.remove_transaction(self)
407
407
  @plan = nil
408
+
409
+ yield if block_given?
408
410
  end
409
411
  end
410
412
  def committed_transaction; super if defined? super end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -162,46 +162,54 @@ class TC_PlanningLoop < Test::Unit::TestCase
162
162
  # end. The system tries to always have some prepared subplans ready to be
163
163
  # executed.
164
164
  def test_periodic
165
- main_task, loop_planner = prepare_plan :period => 0.5, :lookahead => 2
165
+ main_task, loop_planner = prepare_plan :period => 1, :lookahead => 2
166
166
  loop_planner.start!
167
167
 
168
- assert_equal(2, loop_planner.patterns.size)
169
- first_planner = loop_planner.patterns[-1].first
170
- second_planner = loop_planner.patterns[-2].first
171
- assert(first_planner.running?)
172
- assert(!second_planner.running?)
168
+ FlexMock.use(Time) do |time_proxy|
169
+ current_time = Time.now + 5
170
+ time_proxy.should_receive(:now).and_return { current_time }
173
171
 
174
- # Call #loop_start! already, to make the loop start the first running
175
- # task as soon as it is ready.
176
- loop_planner.loop_start!
172
+ assert_equal(2, loop_planner.patterns.size)
173
+ first_planner = loop_planner.patterns[-1].first
174
+ second_planner = loop_planner.patterns[-2].first
175
+ assert(first_planner.running?)
176
+ assert(!second_planner.running?)
177
177
 
178
- # Usual pattern: wait for the result of the first two planners, check
179
- # that the first task actually runs
180
- first_task = planning_task_result(first_planner)
181
- second_task = planning_task_result(second_planner)
182
- third_planner = loop_planner.patterns[-3].first
183
- assert(third_planner.running?)
184
- assert(first_task.running?)
185
- assert(second_task.pending?)
178
+ # Call #loop_start! already, to make the loop start the first running
179
+ # task as soon as it is ready.
180
+ loop_planner.loop_start!
186
181
 
187
- # Make the first task finish and make sure the system does not start it right away
188
- first_task.success!
189
- assert(first_task.success?)
190
- assert(second_task.pending?)
191
- process_events
192
- assert(second_task.pending?)
193
- sleep(0.6)
194
- process_events
195
- assert(second_task.running?, loop_planner.arguments)
196
-
197
- # Use the third task to check that the timeout can be overriden by
198
- # calling loop_start! on the PlanningLoop task
199
- third_task = planning_task_result(third_planner)
182
+ # Usual pattern: wait for the result of the first two planners, check
183
+ # that the first task actually runs
184
+ first_task = planning_task_result(first_planner)
185
+ second_task = planning_task_result(second_planner)
186
+ third_planner = loop_planner.patterns[-3].first
187
+ assert(third_planner.running?)
188
+ assert(first_task.running?)
189
+ assert(second_task.pending?)
190
+
191
+ # Make the first task finish and make sure the system does not start it right away
192
+ first_task.success!
193
+ assert(first_task.success?)
194
+ assert(second_task.pending?)
195
+
196
+ current_time += 0.2
197
+ process_events
198
+ assert(second_task.pending?)
200
199
 
201
- assert(second_task.running? && !third_task.running?)
202
- second_task.success!
203
- loop_planner.loop_start!
204
- assert(!second_task.running? && third_task.running?)
200
+ current_time += 0.8
201
+ process_events
202
+ assert(second_task.running?, loop_planner.arguments)
203
+
204
+ # Use the third task to check that the timeout can be overriden by
205
+ # calling loop_start! on the PlanningLoop task
206
+ third_task = planning_task_result(third_planner)
207
+
208
+ assert(second_task.running? && !third_task.running?)
209
+ second_task.success!
210
+ loop_planner.loop_start!
211
+ assert(!second_task.running? && third_task.running?)
212
+ end
205
213
  end
206
214
 
207
215
  # Test periodic loop tasks with zero lookahead
data/test/suite_core.rb CHANGED
@@ -9,11 +9,11 @@ require 'test_state'
9
9
  require 'test_propagation'
10
10
  require 'test_exceptions'
11
11
 
12
-
13
12
  require 'test_plan'
14
13
  require 'test_query'
15
14
  require 'test_transactions'
16
15
  require 'test_transactions_proxy'
16
+ require 'test_thread_task'
17
17
 
18
18
  require 'suite_planning'
19
19
  require 'suite_relations'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roby
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.7"
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-05-28 00:00:00 +02:00
12
+ date: 2008-05-29 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -528,43 +528,43 @@ required_rubygems_version: !ruby/object:Gem::Requirement
528
528
  requirements: []
529
529
 
530
530
  rubyforge_project: roby
531
- rubygems_version: 1.0.1
531
+ rubygems_version: 1.1.1
532
532
  signing_key:
533
533
  specification_version: 2
534
534
  summary: A plan-based control framework for autonomous systems
535
535
  test_files:
536
- - test/test_transactions.rb
537
- - test/test_task.rb
538
- - test/test_log_server.rb
539
- - test/planning/test_model.rb
540
- - test/planning/test_task.rb
536
+ - test/relations/test_hierarchy.rb
537
+ - test/relations/test_planned_by.rb
538
+ - test/relations/test_executed_by.rb
539
+ - test/relations/test_conflicts.rb
540
+ - test/relations/test_ensured.rb
541
+ - test/test_exceptions.rb
542
+ - test/test_query.rb
541
543
  - test/planning/test_loops.rb
544
+ - test/planning/test_task.rb
545
+ - test/planning/test_model.rb
546
+ - test/test_transactions.rb
542
547
  - test/test_support.rb
543
- - test/test_control.rb
544
- - test/test_exceptions.rb
548
+ - test/test_relations.rb
549
+ - test/test_interface.rb
550
+ - test/test_log_server.rb
551
+ - test/test_event.rb
552
+ - test/test_bgl.rb
545
553
  - test/test_plan.rb
546
- - test/test_log.rb
547
- - test/distributed/test_execution.rb
548
- - test/distributed/test_connection.rb
554
+ - test/test_thread_task.rb
555
+ - test/distributed/test_query.rb
549
556
  - test/distributed/test_communication.rb
557
+ - test/distributed/test_transaction.rb
550
558
  - test/distributed/test_remote_plan.rb
551
- - test/distributed/test_mixed_plan.rb
552
559
  - test/distributed/test_plan_notifications.rb
553
- - test/distributed/test_transaction.rb
554
- - test/distributed/test_query.rb
560
+ - test/distributed/test_mixed_plan.rb
561
+ - test/distributed/test_connection.rb
562
+ - test/distributed/test_execution.rb
555
563
  - test/distributed/test_protocol.rb
564
+ - test/test_task.rb
565
+ - test/test_control.rb
556
566
  - test/test_transactions_proxy.rb
557
- - test/test_relations.rb
558
567
  - test/test_testcase.rb
559
- - test/test_query.rb
560
- - test/test_interface.rb
561
- - test/relations/test_planned_by.rb
562
- - test/relations/test_executed_by.rb
563
- - test/relations/test_hierarchy.rb
564
- - test/relations/test_conflicts.rb
565
- - test/relations/test_ensured.rb
566
- - test/test_bgl.rb
567
- - test/test_thread_task.rb
568
- - test/test_event.rb
569
- - test/test_state.rb
570
568
  - test/test_propagation.rb
569
+ - test/test_state.rb
570
+ - test/test_log.rb