roby 0.8.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.deep-cover.rb +3 -0
- data/.gitattributes +1 -0
- data/.gitignore +24 -0
- data/.simplecov +10 -0
- data/.travis.yml +17 -0
- data/.yardopts +4 -0
- data/Gemfile +15 -0
- data/README.md +11 -0
- data/Rakefile +47 -177
- data/benchmark/{alloc_misc.rb → attic/alloc_misc.rb} +2 -2
- data/benchmark/{discovery_latency.rb → attic/discovery_latency.rb} +19 -19
- data/benchmark/{garbage_collection.rb → attic/garbage_collection.rb} +9 -9
- data/benchmark/{genom.rb → attic/genom.rb} +0 -0
- data/benchmark/attic/transactions.rb +62 -0
- data/benchmark/plan_basic_operations.rb +28 -0
- data/benchmark/relations/graph.rb +63 -0
- data/benchmark/ruby/identity.rb +18 -0
- data/benchmark/ruby/set_intersect_vs_hash_merge.rb +39 -0
- data/benchmark/ruby/yield_vs_block.rb +35 -0
- data/benchmark/run +5 -0
- data/benchmark/synthetic_plan_modifications_with_transactions.rb +79 -0
- data/benchmark/transactions.rb +99 -51
- data/bin/roby +38 -197
- data/bin/roby-display +14 -0
- data/bin/roby-log +3 -176
- data/doc/guide/{src → attic}/abstraction/achieve_with.page +1 -1
- data/doc/guide/{src → attic}/abstraction/forwarding.page +1 -1
- data/doc/guide/{src → attic}/abstraction/hierarchy.page +1 -1
- data/doc/guide/{src → attic}/abstraction/index.page +1 -1
- data/doc/guide/{src → attic}/abstraction/task_models.page +1 -1
- data/doc/guide/{overview.rdoc → attic/cycle/api_overview.rdoc} +6 -1
- data/doc/guide/{src → attic}/cycle/cycle-overview.png +0 -0
- data/doc/guide/{src → attic}/cycle/cycle-overview.svg +0 -0
- data/doc/guide/attic/cycle/error_handling.page +98 -0
- data/doc/guide/{src → attic}/cycle/error_instantaneous_repair.png +0 -0
- data/doc/guide/{src → attic}/cycle/error_instantaneous_repair.svg +0 -0
- data/doc/guide/{src/cycle/error_handling.page → attic/cycle/error_sources.page} +46 -89
- data/doc/guide/{src → attic}/cycle/garbage_collection.page +1 -1
- data/doc/guide/{src → attic}/cycle/index.page +1 -1
- data/doc/guide/{src → attic}/cycle/propagation.page +11 -1
- data/doc/guide/{src → attic}/cycle/propagation_diamond.png +0 -0
- data/doc/guide/{src → attic}/cycle/propagation_diamond.svg +0 -0
- data/doc/guide/attic/plans/building_plans.page +89 -0
- data/doc/guide/attic/plans/code.page +192 -0
- data/doc/guide/{src/basics → attic/plans}/events.page +3 -4
- data/doc/guide/attic/plans/index.page +7 -0
- data/doc/guide/{plan_modifications.rdoc → attic/plans/plan_modifications.rdoc} +5 -3
- data/doc/guide/{src/basics → attic/plans}/plan_objects.page +2 -1
- data/doc/guide/attic/plans/querying_plans.page +5 -0
- data/doc/guide/{src/basics → attic/plans}/tasks.page +20 -20
- data/doc/guide/config.yaml +7 -4
- data/doc/guide/ext/extended_menu.rb +29 -0
- data/doc/guide/ext/init.rb +6 -0
- data/doc/guide/ext/rdoc_links.rb +7 -6
- data/doc/guide/src/advanced_concepts/history.page +5 -0
- data/doc/guide/src/advanced_concepts/index.page +11 -0
- data/doc/guide/src/advanced_concepts/recognizing_patterns.page +83 -0
- data/doc/guide/src/advanced_concepts/scheduling.page +87 -0
- data/doc/guide/src/advanced_concepts/transactions.page +5 -0
- data/doc/guide/src/advanced_concepts/unreachability.page +42 -0
- data/doc/guide/src/base.template +96 -0
- data/doc/guide/src/basics_shell_header.txt +5 -7
- data/doc/guide/src/building/action_coordination.page +96 -0
- data/doc/guide/src/building/actions.page +124 -0
- data/doc/guide/src/building/file_layout.page +71 -0
- data/doc/guide/src/building/index.page +50 -0
- data/doc/guide/src/building/patterns.page +86 -0
- data/doc/guide/src/building/patterns_forwarding.png +0 -0
- data/doc/guide/src/building/patterns_forwarding.svg +277 -0
- data/doc/guide/src/building/runtime.page +95 -0
- data/doc/guide/src/building/task_models.page +94 -0
- data/doc/guide/src/building/tasks.page +284 -0
- data/doc/guide/src/concepts/error_handling.page +100 -0
- data/doc/guide/src/concepts/exception_propagation.png +0 -0
- data/doc/guide/src/concepts/exception_propagation.svg +445 -0
- data/doc/guide/src/concepts/execution.page +85 -0
- data/doc/guide/src/concepts/execution.png +0 -0
- data/doc/guide/src/concepts/execution.svg +573 -0
- data/doc/guide/src/concepts/execution_cycle.png +0 -0
- data/doc/guide/src/concepts/garbage_collection.page +57 -0
- data/doc/guide/src/concepts/index.page +27 -0
- data/doc/guide/src/concepts/plans.page +101 -0
- data/doc/guide/src/concepts/policy.page +31 -0
- data/doc/guide/src/concepts/reactor.page +61 -0
- data/doc/guide/src/concepts/simple_plan_example.png +0 -0
- data/doc/guide/src/concepts/simple_plan_example.svg +376 -0
- data/doc/guide/src/default.template +9 -74
- data/doc/guide/src/event_relations/forward.page +71 -0
- data/doc/guide/src/event_relations/index.page +12 -0
- data/doc/guide/src/event_relations/scheduling_constraints.page +43 -0
- data/doc/guide/src/event_relations/signal.page +55 -0
- data/doc/guide/src/event_relations/temporal_constraints.page +77 -0
- data/doc/guide/src/htmldoc.metainfo +21 -8
- data/doc/guide/src/index.page +8 -3
- data/doc/guide/src/{introduction/install.page → installation/index.page} +37 -25
- data/doc/guide/src/installation/publications.page +14 -0
- data/doc/guide/src/{introduction → installation}/videos.page +14 -7
- data/doc/guide/src/interacting/index.page +16 -0
- data/doc/guide/src/interacting/run.page +33 -0
- data/doc/guide/src/interacting/shell.page +95 -0
- data/doc/guide/src/plugins/creating_plugins.page +72 -0
- data/doc/guide/src/plugins/index.page +27 -5
- data/doc/guide/src/plugins/{fault_tolerance.page → standard_plugins/fault_tolerance.page} +2 -2
- data/doc/guide/src/plugins/standard_plugins/index.page +11 -0
- data/doc/guide/src/plugins/{subsystems.page → standard_plugins/subsystems.page} +2 -2
- data/doc/guide/src/style_screen.css +687 -0
- data/doc/guide/src/task_relations/dependency.page +107 -0
- data/doc/guide/src/task_relations/executed_by.page +77 -0
- data/doc/guide/src/task_relations/index.page +12 -0
- data/doc/guide/src/task_relations/new_relations.page +119 -0
- data/doc/guide/src/task_relations/planned_by.page +46 -0
- data/doc/guide/src/tutorial/app.page +117 -0
- data/doc/guide/src/{basics → tutorial}/code_examples.page +6 -5
- data/doc/guide/src/{basics → tutorial}/dry.page +15 -15
- data/doc/guide/src/{basics → tutorial}/errors.page +43 -68
- data/doc/guide/src/tutorial/events.page +195 -0
- data/doc/guide/src/{basics → tutorial}/hierarchy.page +53 -52
- data/doc/guide/src/tutorial/index.page +13 -0
- data/doc/guide/src/tutorial/log_replay/goForward_1.png +0 -0
- data/doc/guide/src/tutorial/log_replay/goForward_2.png +0 -0
- data/doc/guide/src/tutorial/log_replay/goForward_3.png +0 -0
- data/doc/guide/src/{basics → tutorial}/log_replay/goForward_4.png +0 -0
- data/doc/guide/src/tutorial/log_replay/goForward_5.png +0 -0
- data/doc/guide/src/{basics → tutorial}/log_replay/hierarchy_error_1.png +0 -0
- data/doc/guide/src/{basics → tutorial}/log_replay/hierarchy_error_2.png +0 -0
- data/doc/guide/src/{basics → tutorial}/log_replay/hierarchy_error_3.png +0 -0
- data/doc/guide/src/tutorial/log_replay/moveto_code_error.png +0 -0
- data/doc/guide/src/{basics → tutorial}/log_replay/plan_repair_1.png +0 -0
- data/doc/guide/src/{basics → tutorial}/log_replay/plan_repair_2.png +0 -0
- data/doc/guide/src/{basics → tutorial}/log_replay/plan_repair_3.png +0 -0
- data/doc/guide/src/tutorial/log_replay/plan_repair_4.png +0 -0
- data/doc/guide/src/tutorial/log_replay/roby_log_main_window.png +0 -0
- data/doc/guide/src/{basics → tutorial}/log_replay/roby_log_relation_window.png +0 -0
- data/doc/guide/src/{basics → tutorial}/log_replay/roby_replay_event_representation.png +0 -0
- data/doc/guide/src/tutorial/relations_display.page +153 -0
- data/doc/guide/src/{basics → tutorial}/roby_cycle_overview.png +0 -0
- data/doc/guide/src/tutorial/shell.page +121 -0
- data/doc/guide/src/{basics → tutorial}/summary.page +1 -1
- data/doc/guide/src/tutorial/tasks.page +374 -0
- data/lib/roby.rb +102 -47
- data/lib/roby/actions.rb +17 -0
- data/lib/roby/actions/action.rb +80 -0
- data/lib/roby/actions/interface.rb +45 -0
- data/lib/roby/actions/library.rb +23 -0
- data/lib/roby/actions/models/action.rb +224 -0
- data/lib/roby/actions/models/coordination_action.rb +58 -0
- data/lib/roby/actions/models/interface.rb +22 -0
- data/lib/roby/actions/models/interface_base.rb +294 -0
- data/lib/roby/actions/models/library.rb +12 -0
- data/lib/roby/actions/models/method_action.rb +90 -0
- data/lib/roby/actions/task.rb +114 -0
- data/lib/roby/and_generator.rb +125 -0
- data/lib/roby/app.rb +2795 -829
- data/lib/roby/app/autotest_console_reporter.rb +138 -0
- data/lib/roby/app/base.rb +21 -0
- data/lib/roby/app/cucumber.rb +2 -0
- data/lib/roby/app/cucumber/controller.rb +439 -0
- data/lib/roby/app/cucumber/helpers.rb +280 -0
- data/lib/roby/app/cucumber/world.rb +32 -0
- data/lib/roby/app/debug.rb +136 -0
- data/lib/roby/app/gen.rb +2 -0
- data/lib/roby/app/rake.rb +178 -38
- data/lib/roby/app/robot_config.rb +9 -0
- data/lib/roby/app/robot_names.rb +115 -0
- data/lib/roby/app/run.rb +3 -2
- data/lib/roby/app/scripts.rb +72 -0
- data/lib/roby/app/scripts/autotest.rb +173 -0
- data/lib/roby/app/scripts/display.rb +2 -0
- data/lib/roby/app/scripts/restart.rb +52 -0
- data/lib/roby/app/scripts/results.rb +17 -8
- data/lib/roby/app/scripts/run.rb +155 -24
- data/lib/roby/app/scripts/shell.rb +147 -62
- data/lib/roby/app/scripts/test.rb +107 -22
- data/lib/roby/app/test_reporter.rb +74 -0
- data/lib/roby/app/test_server.rb +159 -0
- data/lib/roby/app/vagrant.rb +47 -0
- data/lib/roby/backports.rb +16 -0
- data/lib/roby/cli/display.rb +190 -0
- data/lib/roby/cli/exceptions.rb +17 -0
- data/lib/roby/cli/gen/actions/class.rb +5 -0
- data/lib/roby/cli/gen/actions/test.rb +6 -0
- data/lib/roby/cli/gen/app/.yardopts +6 -0
- data/lib/roby/cli/gen/app/README.md +28 -0
- data/lib/roby/cli/gen/app/Rakefile +15 -0
- data/{app → lib/roby/cli/gen/app}/config/app.yml +29 -39
- data/lib/roby/cli/gen/app/models/.gitattributes +1 -0
- data/{app → lib/roby/cli/gen/app/scripts}/controllers/.gitattributes +0 -0
- data/{app/data/.gitattributes → lib/roby/cli/gen/app/test/.gitignore} +0 -0
- data/lib/roby/cli/gen/class/class.rb +6 -0
- data/lib/roby/cli/gen/class/test.rb +7 -0
- data/lib/roby/cli/gen/helpers.rb +203 -0
- data/lib/roby/cli/gen/module/module.rb +5 -0
- data/lib/roby/cli/gen/module/test.rb +6 -0
- data/lib/roby/cli/gen/roby_app/config/init.rb +17 -0
- data/lib/roby/cli/gen/roby_app/config/robots/robot.rb +40 -0
- data/lib/roby/cli/gen/task/class.rb +44 -0
- data/lib/roby/cli/gen/task/test.rb +6 -0
- data/lib/roby/cli/gen_main.rb +120 -0
- data/lib/roby/cli/log.rb +276 -0
- data/lib/roby/cli/log/flamegraph.html +499 -0
- data/lib/roby/cli/log/flamegraph_renderer.rb +88 -0
- data/lib/roby/cli/main.rb +153 -0
- data/lib/roby/coordination.rb +60 -0
- data/lib/roby/coordination/action_script.rb +25 -0
- data/lib/roby/coordination/action_state_machine.rb +125 -0
- data/lib/roby/coordination/actions.rb +106 -0
- data/lib/roby/coordination/base.rb +145 -0
- data/lib/roby/coordination/calculus.rb +40 -0
- data/lib/roby/coordination/child.rb +28 -0
- data/lib/roby/coordination/event.rb +29 -0
- data/lib/roby/coordination/fault_handler.rb +25 -0
- data/lib/roby/coordination/fault_handling_task.rb +13 -0
- data/lib/roby/coordination/fault_response_table.rb +110 -0
- data/lib/roby/coordination/models/action_script.rb +64 -0
- data/lib/roby/coordination/models/action_state_machine.rb +224 -0
- data/lib/roby/coordination/models/actions.rb +191 -0
- data/lib/roby/coordination/models/arguments.rb +55 -0
- data/lib/roby/coordination/models/base.rb +176 -0
- data/lib/roby/coordination/models/capture.rb +86 -0
- data/lib/roby/coordination/models/child.rb +35 -0
- data/lib/roby/coordination/models/event.rb +41 -0
- data/lib/roby/coordination/models/exceptions.rb +42 -0
- data/lib/roby/coordination/models/fault_handler.rb +219 -0
- data/lib/roby/coordination/models/fault_response_table.rb +77 -0
- data/lib/roby/coordination/models/root.rb +22 -0
- data/lib/roby/coordination/models/script.rb +283 -0
- data/lib/roby/coordination/models/task.rb +184 -0
- data/lib/roby/coordination/models/task_from_action.rb +50 -0
- data/lib/roby/coordination/models/task_from_as_plan.rb +33 -0
- data/lib/roby/coordination/models/task_from_instanciation_object.rb +31 -0
- data/lib/roby/coordination/models/task_from_variable.rb +27 -0
- data/lib/roby/coordination/models/task_with_dependencies.rb +48 -0
- data/lib/roby/coordination/models/variable.rb +32 -0
- data/lib/roby/coordination/script.rb +200 -0
- data/lib/roby/coordination/script_instruction.rb +12 -0
- data/lib/roby/coordination/task.rb +45 -0
- data/lib/roby/coordination/task_base.rb +69 -0
- data/lib/roby/coordination/task_script.rb +293 -0
- data/lib/roby/coordination/task_state_machine.rb +308 -0
- data/lib/roby/decision_control.rb +33 -21
- data/lib/roby/distributed_object.rb +76 -0
- data/lib/roby/droby.rb +17 -0
- data/lib/roby/droby/droby_id.rb +6 -0
- data/lib/roby/droby/enable.rb +153 -0
- data/lib/roby/droby/event_logger.rb +189 -0
- data/lib/roby/droby/event_logging.rb +57 -0
- data/lib/roby/droby/exceptions.rb +14 -0
- data/lib/roby/droby/identifiable.rb +22 -0
- data/lib/roby/droby/logfile.rb +141 -0
- data/lib/roby/droby/logfile/client.rb +176 -0
- data/lib/roby/droby/logfile/file_format.md +97 -0
- data/lib/roby/droby/logfile/index.rb +117 -0
- data/lib/roby/droby/logfile/reader.rb +139 -0
- data/lib/roby/droby/logfile/server.rb +199 -0
- data/lib/roby/droby/logfile/writer.rb +114 -0
- data/lib/roby/droby/marshal.rb +264 -0
- data/lib/roby/droby/marshallable.rb +12 -0
- data/lib/roby/droby/null_event_logger.rb +25 -0
- data/lib/roby/droby/object_manager.rb +205 -0
- data/lib/roby/droby/peer_id.rb +6 -0
- data/lib/roby/droby/plan_rebuilder.rb +373 -0
- data/lib/roby/droby/rebuilt_plan.rb +160 -0
- data/lib/roby/droby/remote_droby_id.rb +6 -0
- data/lib/roby/droby/timepoints.rb +205 -0
- data/lib/roby/droby/timepoints_ctf.metadata.erb +101 -0
- data/lib/roby/droby/timepoints_ctf.rb +125 -0
- data/lib/roby/droby/v5.rb +14 -0
- data/lib/roby/droby/v5/builtin.rb +120 -0
- data/lib/roby/droby/v5/droby_class.rb +45 -0
- data/lib/roby/droby/v5/droby_constant.rb +81 -0
- data/lib/roby/droby/v5/droby_dump.rb +1026 -0
- data/lib/roby/droby/v5/droby_id.rb +44 -0
- data/lib/roby/droby/v5/droby_model.rb +82 -0
- data/lib/roby/droby/v5/peer_id.rb +10 -0
- data/lib/roby/droby/v5/remote_droby_id.rb +42 -0
- data/lib/roby/event.rb +79 -957
- data/lib/roby/event_constraints.rb +835 -0
- data/lib/roby/event_generator.rb +1047 -0
- data/lib/roby/event_structure/causal_link.rb +6 -0
- data/lib/roby/event_structure/forwarding.rb +6 -0
- data/lib/roby/event_structure/precedence.rb +7 -0
- data/lib/roby/event_structure/signal.rb +8 -0
- data/lib/roby/event_structure/temporal_constraints.rb +640 -0
- data/lib/roby/exceptions.rb +446 -152
- data/lib/roby/executable_plan.rb +549 -0
- data/lib/roby/execution_engine.rb +1997 -950
- data/lib/roby/filter_generator.rb +26 -0
- data/lib/roby/gui/chronicle_view.rb +225 -0
- data/lib/roby/gui/chronicle_widget.rb +925 -0
- data/lib/roby/gui/dot_id.rb +11 -0
- data/lib/roby/gui/exception_view.rb +44 -0
- data/lib/roby/gui/log_display.rb +273 -0
- data/lib/roby/gui/model_views.rb +2 -0
- data/lib/roby/gui/model_views/action_interface.rb +53 -0
- data/lib/roby/gui/model_views/task.rb +47 -0
- data/lib/roby/gui/model_views/task.rhtml +41 -0
- data/lib/roby/gui/object_info_view.rb +89 -0
- data/lib/roby/gui/plan_dot_layout.rb +427 -0
- data/lib/roby/gui/plan_rebuilder_widget.rb +357 -0
- data/lib/roby/gui/qt4_toMSecsSinceEpoch.rb +8 -0
- data/lib/roby/gui/relations_view.rb +278 -0
- data/lib/roby/gui/relations_view/relations.ui +139 -0
- data/lib/roby/gui/relations_view/relations_canvas.rb +1088 -0
- data/lib/roby/gui/relations_view/relations_config.rb +292 -0
- data/lib/roby/gui/relations_view/relations_view.ui +53 -0
- data/lib/roby/gui/scheduler_view.css +24 -0
- data/lib/roby/gui/scheduler_view.rb +46 -0
- data/lib/roby/gui/scheduler_view.rhtml +53 -0
- data/lib/roby/gui/stepping.rb +93 -0
- data/lib/roby/gui/stepping.ui +181 -0
- data/lib/roby/gui/styles.rb +81 -0
- data/lib/roby/gui/task_display_configuration.rb +42 -0
- data/lib/roby/gui/task_state_at.rb +38 -0
- data/lib/roby/hooks.rb +26 -0
- data/lib/roby/interface.rb +136 -469
- data/lib/roby/interface/async.rb +20 -0
- data/lib/roby/interface/async/action_monitor.rb +188 -0
- data/lib/roby/interface/async/interface.rb +498 -0
- data/lib/roby/interface/async/job_monitor.rb +213 -0
- data/lib/roby/interface/async/log.rb +238 -0
- data/lib/roby/interface/async/new_job_listener.rb +79 -0
- data/lib/roby/interface/async/ui_connector.rb +183 -0
- data/lib/roby/interface/client.rb +553 -0
- data/lib/roby/interface/command.rb +24 -0
- data/lib/roby/interface/command_argument.rb +16 -0
- data/lib/roby/interface/command_library.rb +92 -0
- data/lib/roby/interface/droby_channel.rb +174 -0
- data/lib/roby/interface/exceptions.rb +22 -0
- data/lib/roby/interface/interface.rb +655 -0
- data/lib/roby/interface/job.rb +47 -0
- data/lib/roby/interface/rest.rb +10 -0
- data/lib/roby/interface/rest/api.rb +29 -0
- data/lib/roby/interface/rest/helpers.rb +24 -0
- data/lib/roby/interface/rest/server.rb +212 -0
- data/lib/roby/interface/server.rb +154 -0
- data/lib/roby/interface/shell_client.rb +468 -0
- data/lib/roby/interface/shell_subcommand.rb +24 -0
- data/lib/roby/interface/subcommand_client.rb +35 -0
- data/lib/roby/interface/tcp.rb +168 -0
- data/lib/roby/models/arguments.rb +112 -0
- data/lib/roby/models/plan_object.rb +83 -0
- data/lib/roby/models/task.rb +835 -0
- data/lib/roby/models/task_event.rb +62 -0
- data/lib/roby/models/task_service.rb +78 -0
- data/lib/roby/or_generator.rb +88 -0
- data/lib/roby/plan.rb +1751 -864
- data/lib/roby/plan_object.rb +611 -0
- data/lib/roby/plan_service.rb +200 -0
- data/lib/roby/promise.rb +332 -0
- data/lib/roby/queries.rb +23 -0
- data/lib/roby/queries/and_matcher.rb +32 -0
- data/lib/roby/queries/any.rb +27 -0
- data/lib/roby/queries/code_error_matcher.rb +58 -0
- data/lib/roby/queries/event_generator_matcher.rb +9 -0
- data/lib/roby/queries/execution_exception_matcher.rb +165 -0
- data/lib/roby/queries/index.rb +165 -0
- data/lib/roby/queries/localized_error_matcher.rb +149 -0
- data/lib/roby/queries/matcher_base.rb +107 -0
- data/lib/roby/queries/none.rb +27 -0
- data/lib/roby/queries/not_matcher.rb +30 -0
- data/lib/roby/queries/op_matcher.rb +8 -0
- data/lib/roby/queries/or_matcher.rb +30 -0
- data/lib/roby/queries/plan_object_matcher.rb +363 -0
- data/lib/roby/queries/query.rb +188 -0
- data/lib/roby/queries/task_event_generator_matcher.rb +86 -0
- data/lib/roby/queries/task_matcher.rb +344 -0
- data/lib/roby/relations.rb +42 -678
- data/lib/roby/relations/bidirectional_directed_adjacency_graph.rb +492 -0
- data/lib/roby/relations/directed_relation_support.rb +268 -0
- data/lib/roby/relations/event_relation_graph.rb +19 -0
- data/lib/roby/relations/fork_merge_visitor.rb +154 -0
- data/lib/roby/relations/graph.rb +533 -0
- data/lib/roby/relations/models/directed_relation_support.rb +11 -0
- data/lib/roby/relations/models/graph.rb +75 -0
- data/lib/roby/relations/models/task_relation_graph.rb +18 -0
- data/lib/roby/relations/space.rb +380 -0
- data/lib/roby/relations/task_relation_graph.rb +20 -0
- data/lib/roby/robot.rb +85 -38
- data/lib/roby/schedulers/basic.rb +155 -25
- data/lib/roby/schedulers/null.rb +20 -0
- data/lib/roby/schedulers/reporting.rb +31 -0
- data/lib/roby/schedulers/state.rb +129 -0
- data/lib/roby/schedulers/temporal.rb +91 -0
- data/lib/roby/singletons.rb +87 -0
- data/lib/roby/standalone.rb +4 -2
- data/lib/roby/standard_errors.rb +405 -82
- data/lib/roby/state.rb +6 -3
- data/lib/roby/state/conf_model.rb +5 -0
- data/lib/roby/state/events.rb +181 -95
- data/lib/roby/state/goal_model.rb +77 -0
- data/lib/roby/state/open_struct.rb +591 -0
- data/lib/roby/state/open_struct_model.rb +68 -0
- data/lib/roby/state/pos.rb +45 -45
- data/lib/roby/state/shapes.rb +11 -11
- data/lib/roby/state/state_model.rb +303 -0
- data/lib/roby/state/task.rb +43 -0
- data/lib/roby/support.rb +88 -148
- data/lib/roby/task.rb +1361 -1750
- data/lib/roby/task_arguments.rb +428 -0
- data/lib/roby/task_event.rb +127 -0
- data/lib/roby/task_event_generator.rb +337 -0
- data/lib/roby/task_service.rb +6 -0
- data/lib/roby/task_structure/conflicts.rb +104 -0
- data/lib/roby/task_structure/dependency.rb +932 -0
- data/lib/roby/task_structure/error_handling.rb +118 -0
- data/lib/roby/task_structure/executed_by.rb +234 -0
- data/lib/roby/task_structure/planned_by.rb +90 -0
- data/lib/roby/tasks/aggregator.rb +37 -0
- data/lib/roby/tasks/external_process.rb +275 -0
- data/lib/roby/tasks/group.rb +27 -0
- data/lib/roby/tasks/null.rb +19 -0
- data/lib/roby/tasks/parallel.rb +43 -0
- data/lib/roby/tasks/sequence.rb +88 -0
- data/lib/roby/tasks/simple.rb +21 -0
- data/lib/roby/{thread_task.rb → tasks/thread.rb} +50 -24
- data/lib/roby/tasks/timeout.rb +17 -0
- data/lib/roby/tasks/virtual.rb +55 -0
- data/lib/roby/template_plan.rb +7 -0
- data/lib/roby/test/aruba_minitest.rb +74 -0
- data/lib/roby/test/assertion.rb +16 -0
- data/lib/roby/test/assertions.rb +490 -0
- data/lib/roby/test/common.rb +368 -591
- data/lib/roby/test/dsl.rb +149 -0
- data/lib/roby/test/error.rb +18 -0
- data/lib/roby/test/event_reporter.rb +83 -0
- data/lib/roby/test/execution_expectations.rb +1134 -0
- data/lib/roby/test/expect_execution.rb +151 -0
- data/lib/roby/test/minitest_helpers.rb +166 -0
- data/lib/roby/test/roby_app_helpers.rb +200 -0
- data/lib/roby/test/run_planners.rb +155 -0
- data/lib/roby/test/self.rb +112 -0
- data/lib/roby/test/spec.rb +198 -0
- data/lib/roby/test/tasks/empty_task.rb +4 -4
- data/lib/roby/test/tasks/goto.rb +28 -27
- data/lib/roby/test/teardown_plans.rb +100 -0
- data/lib/roby/test/testcase.rb +239 -307
- data/lib/roby/test/tools.rb +159 -155
- data/lib/roby/test/validate_state_machine.rb +75 -0
- data/lib/roby/transaction.rb +1125 -0
- data/lib/roby/transaction/event_generator_proxy.rb +63 -0
- data/lib/roby/transaction/plan_object_proxy.rb +99 -0
- data/lib/roby/transaction/plan_service_proxy.rb +43 -0
- data/lib/roby/transaction/proxying.rb +120 -0
- data/lib/roby/transaction/task_event_generator_proxy.rb +19 -0
- data/lib/roby/transaction/task_proxy.rb +135 -0
- data/lib/roby/until_generator.rb +30 -0
- data/lib/roby/version.rb +5 -0
- data/lib/roby/yard.rb +169 -0
- data/lib/yard-roby.rb +1 -0
- data/manifest.xml +32 -6
- data/roby.gemspec +59 -0
- metadata +788 -587
- data/Manifest.txt +0 -321
- data/NOTES +0 -4
- data/README.txt +0 -166
- data/TODO.txt +0 -146
- data/app/README.txt +0 -24
- data/app/Rakefile +0 -8
- data/app/config/ROBOT.rb +0 -5
- data/app/config/init.rb +0 -33
- data/app/config/roby.yml +0 -3
- data/app/controllers/ROBOT.rb +0 -2
- data/app/planners/ROBOT/main.rb +0 -6
- data/app/planners/main.rb +0 -5
- data/app/scripts/distributed +0 -3
- data/app/scripts/generate/bookmarks +0 -3
- data/app/scripts/replay +0 -3
- data/app/scripts/results +0 -3
- data/app/scripts/run +0 -3
- data/app/scripts/server +0 -3
- data/app/scripts/shell +0 -3
- data/app/scripts/test +0 -3
- data/app/tasks/.gitattributes +0 -0
- data/app/tasks/ROBOT/.gitattributes +0 -0
- data/bin/roby-shell +0 -25
- data/doc/guide/src/basics/app.page +0 -139
- data/doc/guide/src/basics/index.page +0 -11
- data/doc/guide/src/basics/log_replay/goForward_1.png +0 -0
- data/doc/guide/src/basics/log_replay/goForward_2.png +0 -0
- data/doc/guide/src/basics/log_replay/goForward_3.png +0 -0
- data/doc/guide/src/basics/log_replay/goForward_5.png +0 -0
- data/doc/guide/src/basics/log_replay/plan_repair_4.png +0 -0
- data/doc/guide/src/basics/log_replay/roby_log_main_window.png +0 -0
- data/doc/guide/src/basics/relations_display.page +0 -203
- data/doc/guide/src/basics/shell.page +0 -102
- data/doc/guide/src/default.css +0 -319
- data/doc/guide/src/introduction/index.page +0 -29
- data/doc/guide/src/introduction/publications.page +0 -14
- data/doc/guide/src/relations/dependency.page +0 -89
- data/doc/guide/src/relations/index.page +0 -12
- data/ext/droby/dump.cc +0 -175
- data/ext/droby/extconf.rb +0 -3
- data/ext/graph/algorithm.cc +0 -746
- data/ext/graph/extconf.rb +0 -7
- data/ext/graph/graph.cc +0 -575
- data/ext/graph/graph.hh +0 -183
- data/ext/graph/iterator_sequence.hh +0 -102
- data/ext/graph/undirected_dfs.hh +0 -226
- data/ext/graph/undirected_graph.hh +0 -421
- data/lib/roby/app/scripts/generate/bookmarks.rb +0 -162
- data/lib/roby/app/scripts/replay.rb +0 -31
- data/lib/roby/app/scripts/server.rb +0 -18
- data/lib/roby/basic_object.rb +0 -151
- data/lib/roby/config.rb +0 -14
- data/lib/roby/distributed.rb +0 -36
- data/lib/roby/distributed/base.rb +0 -448
- data/lib/roby/distributed/communication.rb +0 -875
- data/lib/roby/distributed/connection_space.rb +0 -616
- data/lib/roby/distributed/distributed_object.rb +0 -206
- data/lib/roby/distributed/drb.rb +0 -62
- data/lib/roby/distributed/notifications.rb +0 -531
- data/lib/roby/distributed/peer.rb +0 -555
- data/lib/roby/distributed/protocol.rb +0 -529
- data/lib/roby/distributed/proxy.rb +0 -343
- data/lib/roby/distributed/subscription.rb +0 -311
- data/lib/roby/distributed/transaction.rb +0 -498
- data/lib/roby/external_process_task.rb +0 -225
- data/lib/roby/graph.rb +0 -160
- data/lib/roby/log.rb +0 -3
- data/lib/roby/log/chronicle.rb +0 -303
- data/lib/roby/log/console.rb +0 -74
- data/lib/roby/log/data_stream.rb +0 -275
- data/lib/roby/log/dot.rb +0 -279
- data/lib/roby/log/event_stream.rb +0 -161
- data/lib/roby/log/file.rb +0 -396
- data/lib/roby/log/gui/basic_display.ui +0 -83
- data/lib/roby/log/gui/basic_display_ui.rb +0 -89
- data/lib/roby/log/gui/chronicle.rb +0 -26
- data/lib/roby/log/gui/chronicle_view.rb +0 -40
- data/lib/roby/log/gui/chronicle_view.ui +0 -70
- data/lib/roby/log/gui/chronicle_view_ui.rb +0 -90
- data/lib/roby/log/gui/data_displays.rb +0 -171
- data/lib/roby/log/gui/data_displays.ui +0 -155
- data/lib/roby/log/gui/data_displays_ui.rb +0 -146
- data/lib/roby/log/gui/notifications.rb +0 -26
- data/lib/roby/log/gui/relations.rb +0 -269
- data/lib/roby/log/gui/relations.ui +0 -123
- data/lib/roby/log/gui/relations_ui.rb +0 -120
- data/lib/roby/log/gui/relations_view.rb +0 -185
- data/lib/roby/log/gui/relations_view.ui +0 -149
- data/lib/roby/log/gui/relations_view_ui.rb +0 -144
- data/lib/roby/log/gui/replay.rb +0 -366
- data/lib/roby/log/gui/replay_controls.rb +0 -206
- data/lib/roby/log/gui/replay_controls.ui +0 -282
- data/lib/roby/log/gui/replay_controls_ui.rb +0 -249
- data/lib/roby/log/gui/runtime.rb +0 -130
- data/lib/roby/log/hooks.rb +0 -186
- data/lib/roby/log/logger.rb +0 -203
- data/lib/roby/log/notifications.rb +0 -244
- data/lib/roby/log/plan_rebuilder.rb +0 -468
- data/lib/roby/log/relations.rb +0 -1084
- data/lib/roby/log/server.rb +0 -547
- data/lib/roby/log/sqlite.rb +0 -47
- data/lib/roby/log/timings.rb +0 -233
- data/lib/roby/plan-object.rb +0 -371
- data/lib/roby/planning.rb +0 -13
- data/lib/roby/planning/loops.rb +0 -309
- data/lib/roby/planning/model.rb +0 -1012
- data/lib/roby/planning/task.rb +0 -180
- data/lib/roby/query.rb +0 -655
- data/lib/roby/relations/conflicts.rb +0 -67
- data/lib/roby/relations/dependency.rb +0 -358
- data/lib/roby/relations/ensured.rb +0 -19
- data/lib/roby/relations/error_handling.rb +0 -22
- data/lib/roby/relations/events.rb +0 -7
- data/lib/roby/relations/executed_by.rb +0 -208
- data/lib/roby/relations/influence.rb +0 -10
- data/lib/roby/relations/planned_by.rb +0 -63
- data/lib/roby/state/information.rb +0 -55
- data/lib/roby/state/state.rb +0 -367
- data/lib/roby/task-operations.rb +0 -186
- data/lib/roby/task_index.rb +0 -80
- data/lib/roby/test/distributed.rb +0 -230
- data/lib/roby/test/tasks/simple_task.rb +0 -23
- data/lib/roby/transactions.rb +0 -507
- data/lib/roby/transactions/proxy.rb +0 -325
- data/plugins/fault_injection/History.txt +0 -4
- data/plugins/fault_injection/README.txt +0 -34
- data/plugins/fault_injection/Rakefile +0 -12
- data/plugins/fault_injection/TODO.txt +0 -0
- data/plugins/fault_injection/app.rb +0 -52
- data/plugins/fault_injection/fault_injection.rb +0 -89
- data/plugins/fault_injection/test/test_fault_injection.rb +0 -78
- data/plugins/subsystems/README.txt +0 -37
- data/plugins/subsystems/Rakefile +0 -13
- data/plugins/subsystems/app.rb +0 -182
- data/plugins/subsystems/test/app/README +0 -24
- data/plugins/subsystems/test/app/Rakefile +0 -8
- data/plugins/subsystems/test/app/config/app.yml +0 -71
- data/plugins/subsystems/test/app/config/init.rb +0 -12
- data/plugins/subsystems/test/app/config/roby.yml +0 -3
- data/plugins/subsystems/test/app/planners/main.rb +0 -20
- data/plugins/subsystems/test/app/scripts/distributed +0 -3
- data/plugins/subsystems/test/app/scripts/replay +0 -3
- data/plugins/subsystems/test/app/scripts/results +0 -3
- data/plugins/subsystems/test/app/scripts/run +0 -3
- data/plugins/subsystems/test/app/scripts/server +0 -3
- data/plugins/subsystems/test/app/scripts/shell +0 -3
- data/plugins/subsystems/test/app/scripts/test +0 -3
- data/plugins/subsystems/test/app/tasks/services.rb +0 -15
- data/plugins/subsystems/test/test_subsystems.rb +0 -78
- data/test/distributed/test_communication.rb +0 -195
- data/test/distributed/test_connection.rb +0 -284
- data/test/distributed/test_execution.rb +0 -378
- data/test/distributed/test_mixed_plan.rb +0 -341
- data/test/distributed/test_plan_notifications.rb +0 -238
- data/test/distributed/test_protocol.rb +0 -525
- data/test/distributed/test_query.rb +0 -106
- data/test/distributed/test_remote_plan.rb +0 -491
- data/test/distributed/test_transaction.rb +0 -466
- data/test/mockups/external_process +0 -28
- data/test/mockups/tasks.rb +0 -27
- data/test/planning/test_loops.rb +0 -432
- data/test/planning/test_model.rb +0 -427
- data/test/planning/test_task.rb +0 -126
- data/test/relations/test_conflicts.rb +0 -42
- data/test/relations/test_dependency.rb +0 -324
- data/test/relations/test_ensured.rb +0 -38
- data/test/relations/test_executed_by.rb +0 -224
- data/test/relations/test_planned_by.rb +0 -56
- data/test/suite_core.rb +0 -29
- data/test/suite_distributed.rb +0 -10
- data/test/suite_planning.rb +0 -4
- data/test/suite_relations.rb +0 -8
- data/test/tasks/test_external_process.rb +0 -126
- data/test/tasks/test_thread_task.rb +0 -70
- data/test/test_bgl.rb +0 -528
- data/test/test_event.rb +0 -969
- data/test/test_exceptions.rb +0 -591
- data/test/test_execution_engine.rb +0 -987
- data/test/test_gui.rb +0 -20
- data/test/test_interface.rb +0 -43
- data/test/test_log.rb +0 -125
- data/test/test_log_server.rb +0 -133
- data/test/test_plan.rb +0 -418
- data/test/test_query.rb +0 -424
- data/test/test_relations.rb +0 -260
- data/test/test_state.rb +0 -432
- data/test/test_support.rb +0 -16
- data/test/test_task.rb +0 -1181
- data/test/test_testcase.rb +0 -138
- data/test/test_transactions.rb +0 -610
- data/test/test_transactions_proxy.rb +0 -216
@@ -0,0 +1,120 @@
|
|
1
|
+
require 'set'
|
2
|
+
|
3
|
+
module Roby
|
4
|
+
module DRoby
|
5
|
+
module V5
|
6
|
+
module Builtins
|
7
|
+
module ClassDumper
|
8
|
+
def droby_dump(peer)
|
9
|
+
# Ancestry marshalling stops at the last class that has
|
10
|
+
# ClassDumper built-in. This class is expected to be
|
11
|
+
# resolvable by the remote object manager
|
12
|
+
super_c = superclass
|
13
|
+
super_c = if super_c.kind_of?(ClassDumper)
|
14
|
+
peer.dump(super_c)
|
15
|
+
end
|
16
|
+
|
17
|
+
DRobyClass.new(
|
18
|
+
name,
|
19
|
+
peer.known_siblings_for(self),
|
20
|
+
super_c)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module ExceptionDumper
|
25
|
+
def droby_dump(peer, droby_class: DRoby)
|
26
|
+
formatted = Roby.format_exception(self)
|
27
|
+
droby = droby_class.new(
|
28
|
+
peer.dump(self.class),
|
29
|
+
formatted,
|
30
|
+
message)
|
31
|
+
droby.set_backtrace backtrace
|
32
|
+
droby
|
33
|
+
end
|
34
|
+
|
35
|
+
class DRoby < Exception
|
36
|
+
attr_reader :exception_class
|
37
|
+
attr_reader :formatted_message
|
38
|
+
|
39
|
+
def initialize(exception_class, formatted_message, message = nil)
|
40
|
+
@exception_class, @formatted_message =
|
41
|
+
exception_class, formatted_message
|
42
|
+
super(message)
|
43
|
+
end
|
44
|
+
|
45
|
+
def pretty_print(pp)
|
46
|
+
pp.seplist(formatted_message) do |line|
|
47
|
+
pp.text line
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def proxy(peer)
|
52
|
+
exception = self.class.new(peer.local_object(exception_class), formatted_message, message)
|
53
|
+
exception.set_backtrace backtrace
|
54
|
+
exception
|
55
|
+
end
|
56
|
+
|
57
|
+
def kind_of?(obj)
|
58
|
+
if exception_class.kind_of?(Class)
|
59
|
+
exception_class <= obj
|
60
|
+
else
|
61
|
+
super
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
module ArrayDumper
|
68
|
+
def droby_dump(peer)
|
69
|
+
map do |obj|
|
70
|
+
peer.dump(obj)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def proxy(peer) # :nodoc:
|
75
|
+
map do |element|
|
76
|
+
peer.local_object(element)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
module HashDumper
|
82
|
+
def droby_dump(peer)
|
83
|
+
result = Hash.new
|
84
|
+
each do |k, v|
|
85
|
+
result[peer.dump(k)] = peer.dump(v)
|
86
|
+
end
|
87
|
+
result
|
88
|
+
end
|
89
|
+
|
90
|
+
def proxy(peer) # :nodoc:
|
91
|
+
result = Hash.new
|
92
|
+
each do |k, v|
|
93
|
+
result[peer.local_object(k)] = peer.local_object(v)
|
94
|
+
end
|
95
|
+
result
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
module SetDumper
|
100
|
+
def droby_dump(peer)
|
101
|
+
result = Set.new
|
102
|
+
each do |v|
|
103
|
+
result << peer.dump(v)
|
104
|
+
end
|
105
|
+
result
|
106
|
+
end
|
107
|
+
|
108
|
+
def proxy(peer) # :nodoc:
|
109
|
+
result = Set.new
|
110
|
+
each do |element|
|
111
|
+
result << peer.local_object(element)
|
112
|
+
end
|
113
|
+
result
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Roby
|
2
|
+
module DRoby
|
3
|
+
module V5
|
4
|
+
# Dumps a class and its ancestry
|
5
|
+
#
|
6
|
+
# Use {ClassDumper} to add the corresponding standard {#droby_dump}
|
7
|
+
class DRobyClass
|
8
|
+
# The class name
|
9
|
+
attr_reader :name
|
10
|
+
# The known siblings for this class
|
11
|
+
attr_reader :remote_siblings
|
12
|
+
# The class superclass
|
13
|
+
attr_reader :superclass
|
14
|
+
|
15
|
+
# Initialize a DRobyModel object with the given set of ancestors
|
16
|
+
def initialize(name, remote_siblings, superclass)
|
17
|
+
@name = name
|
18
|
+
@remote_siblings = remote_siblings
|
19
|
+
@superclass = superclass
|
20
|
+
end
|
21
|
+
|
22
|
+
# Returns a local Class object to match this class
|
23
|
+
def proxy(peer)
|
24
|
+
# We have to manually call find_local_model here as it
|
25
|
+
# resolves classes by name as well as by ID
|
26
|
+
if m = peer.find_local_model(self)
|
27
|
+
return m
|
28
|
+
elsif !superclass # this class was supposed to be present
|
29
|
+
raise NoLocalObject, "cannot find local class #{name} as expected by the protocol"
|
30
|
+
else
|
31
|
+
name = self.name
|
32
|
+
local_class = Class.new(peer.local_model(superclass))
|
33
|
+
if name
|
34
|
+
local_class.singleton_class.class_eval do
|
35
|
+
define_method(:name) { name }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
peer.register_model(local_class, remote_siblings)
|
39
|
+
local_class
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
module Roby
|
2
|
+
module DRoby
|
3
|
+
module V5
|
4
|
+
# Dumps a constant by using its name. On reload, #proxy searches for a
|
5
|
+
# constant with the same name, and raises ArgumentError if none exists.
|
6
|
+
#
|
7
|
+
# @example dump instances of a class that are registered as constants
|
8
|
+
# class Klass
|
9
|
+
# include DRobyConstant::Dump
|
10
|
+
# end
|
11
|
+
# # Obj can pass through droby
|
12
|
+
# Obj = Klass.new
|
13
|
+
#
|
14
|
+
# @example dump classes. You usually would prefer using {DRobyModel}
|
15
|
+
# # Klass can pass through droby
|
16
|
+
# class Klass
|
17
|
+
# extend DRobyConstant::Dump
|
18
|
+
# end
|
19
|
+
class DRobyConstant
|
20
|
+
def self.clear_cache
|
21
|
+
@@valid_constants.clear
|
22
|
+
end
|
23
|
+
|
24
|
+
@@valid_constants = Hash.new
|
25
|
+
def self.valid_constants; @@valid_constants end
|
26
|
+
def to_s; "#<dRoby:Constant #{name}>" end
|
27
|
+
|
28
|
+
# Generic implementation of the constant-dumping method. This is to
|
29
|
+
# be included in all kind of classes which should be dumped by their
|
30
|
+
# constant name (for intance Relations::Graph).
|
31
|
+
module Dump
|
32
|
+
class ConstantResolutionFailed < RuntimeError; end
|
33
|
+
class MismatchingLocalConstant < ConstantResolutionFailed; end
|
34
|
+
|
35
|
+
# Returns a DRobyConstant object which references +self+. It
|
36
|
+
# checks that +self+ can actually be referenced locally by
|
37
|
+
# calling <tt>constant(name)</tt>, or raises ArgumentError if
|
38
|
+
# it is not the case.
|
39
|
+
def droby_dump(peer)
|
40
|
+
if constant = DRobyConstant.valid_constants[self]
|
41
|
+
return constant
|
42
|
+
elsif !name
|
43
|
+
raise ConstantResolutionFailed, "#{self}#name returned nil"
|
44
|
+
end
|
45
|
+
|
46
|
+
name = "::#{self.name}"
|
47
|
+
|
48
|
+
begin
|
49
|
+
local_constant = constant(name)
|
50
|
+
rescue Exception => e
|
51
|
+
Roby.warn "could not resolve constant name for #{self}"
|
52
|
+
Roby.log_exception(e, Roby, :warn)
|
53
|
+
raise ConstantResolutionFailed, "cannot resolve constant name for #{self}"
|
54
|
+
end
|
55
|
+
|
56
|
+
if (local_constant == self)
|
57
|
+
DRobyConstant.valid_constants[self] = DRobyConstant.new(name, peer.known_siblings_for(self))
|
58
|
+
else
|
59
|
+
raise MismatchingLocalConstant, "got DRobyConstant whose name '#{name}' resolves to #{local_constant}(#{local_constant.class}), not itself (#{self})"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
attr_reader :remote_siblings
|
65
|
+
|
66
|
+
# The constant name
|
67
|
+
attr_reader :name
|
68
|
+
|
69
|
+
def initialize(name, remote_siblings = Hash.new)
|
70
|
+
@name = name
|
71
|
+
@remote_siblings = remote_siblings
|
72
|
+
end
|
73
|
+
# Returns the local object which can be referenced by this name, or
|
74
|
+
# raises ArgumentError.
|
75
|
+
def proxy(peer); constant(name) end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
|
@@ -0,0 +1,1026 @@
|
|
1
|
+
module Roby
|
2
|
+
module DRoby
|
3
|
+
module V5
|
4
|
+
module BidirectionalGraphDumper
|
5
|
+
class DRoby
|
6
|
+
attr_reader :vertices
|
7
|
+
attr_reader :edges
|
8
|
+
|
9
|
+
def initialize(vertices, edges)
|
10
|
+
@vertices = vertices
|
11
|
+
@edges = edges
|
12
|
+
end
|
13
|
+
|
14
|
+
def proxy(peer)
|
15
|
+
graph = Relations::BidirectionalDirectedAdjacencyGraph.new
|
16
|
+
peer.load_groups(vertices) do |vertices|
|
17
|
+
vertices.each { |v| graph.add_vertex(v) }
|
18
|
+
edges.each_slice(3) do |u, v, info|
|
19
|
+
graph.add_edge(
|
20
|
+
peer.local_object(u),
|
21
|
+
peer.local_object(v),
|
22
|
+
peer.local_object(info))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
graph
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def droby_dump(peer)
|
30
|
+
peer.dump_groups(self.vertices) do |vertices|
|
31
|
+
edges = Array.new
|
32
|
+
each_edge.each do |u, v, info|
|
33
|
+
edges << peer.dump(u) << peer.dump(v) << peer.dump(info)
|
34
|
+
end
|
35
|
+
DRoby.new(vertices, edges)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
module ModelDumper
|
41
|
+
def droby_dump(peer)
|
42
|
+
DRobyModel.new(
|
43
|
+
name,
|
44
|
+
peer.known_siblings_for(self),
|
45
|
+
DRobyModel.dump_supermodel(peer, self),
|
46
|
+
DRobyModel.dump_provided_models_of(peer, self))
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
module ExceptionBaseDumper
|
51
|
+
include Builtins::ExceptionDumper
|
52
|
+
|
53
|
+
def droby_dump(peer)
|
54
|
+
droby = super(peer, droby_class: DRoby)
|
55
|
+
droby.original_exceptions.concat(peer.dump(original_exceptions))
|
56
|
+
droby
|
57
|
+
end
|
58
|
+
|
59
|
+
class DRoby < Builtins::ExceptionDumper::DRoby
|
60
|
+
attr_reader :original_exceptions
|
61
|
+
|
62
|
+
def initialize(exception_class, formatted_class, message = nil)
|
63
|
+
super
|
64
|
+
@original_exceptions = Array.new
|
65
|
+
end
|
66
|
+
|
67
|
+
def proxy(peer)
|
68
|
+
exception = super
|
69
|
+
exception.original_exceptions.
|
70
|
+
concat(peer.local_object(self.original_exceptions))
|
71
|
+
exception
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Exception class used on the unmarshalling of LocalizedError for exception
|
77
|
+
# classes that do not have their own marshalling
|
78
|
+
class UntypedLocalizedError < LocalizedError
|
79
|
+
attr_accessor :formatted_message
|
80
|
+
attr_accessor :exception_class
|
81
|
+
|
82
|
+
def initialize(failure_point, fatal: nil)
|
83
|
+
super(failure_point)
|
84
|
+
@fatal = fatal
|
85
|
+
end
|
86
|
+
|
87
|
+
def fatal?
|
88
|
+
@fatal
|
89
|
+
end
|
90
|
+
|
91
|
+
def pretty_print(pp)
|
92
|
+
pp.seplist(formatted_message) do |line|
|
93
|
+
pp.text line
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def kind_of?(obj)
|
98
|
+
exception_class <= obj
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
module LocalizedErrorDumper
|
103
|
+
# Returns an intermediate representation of +self+ suitable to be sent to
|
104
|
+
# the +dest+ peer.
|
105
|
+
def droby_dump(peer)
|
106
|
+
formatted = Roby.format_exception(self)
|
107
|
+
DRoby.new(peer.dump_model(self.class),
|
108
|
+
peer.dump(failure_point),
|
109
|
+
fatal?,
|
110
|
+
message,
|
111
|
+
backtrace,
|
112
|
+
peer.dump(original_exceptions),
|
113
|
+
formatted)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Intermediate representation used to marshal/unmarshal a LocalizedError
|
117
|
+
class DRoby
|
118
|
+
attr_reader :model, :failure_point, :fatal, :message, :backtrace,
|
119
|
+
:original_exceptions, :formatted_message
|
120
|
+
def initialize(model, failure_point, fatal, message, backtrace,
|
121
|
+
original_exceptions, formatted_message = [])
|
122
|
+
@model, @failure_point, @fatal, @message, @backtrace,
|
123
|
+
@original_exceptions, @formatted_message =
|
124
|
+
model, failure_point, fatal, message, backtrace,
|
125
|
+
original_exceptions, formatted_message
|
126
|
+
end
|
127
|
+
|
128
|
+
def proxy(peer)
|
129
|
+
failure_point = peer.local_object(self.failure_point)
|
130
|
+
error = UntypedLocalizedError.new(failure_point, fatal: fatal)
|
131
|
+
error = error.exception(message)
|
132
|
+
error.original_exceptions.concat(peer.local_object(original_exceptions))
|
133
|
+
error.set_backtrace(backtrace)
|
134
|
+
error.exception_class = peer.local_object(model)
|
135
|
+
error.formatted_message = formatted_message
|
136
|
+
error
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
module PlanningFailedErrorDumper
|
142
|
+
def droby_dump(peer)
|
143
|
+
DRoby.new(peer.dump(planned_task),
|
144
|
+
peer.dump(planning_task),
|
145
|
+
peer.dump(failure_reason))
|
146
|
+
end
|
147
|
+
|
148
|
+
class DRoby
|
149
|
+
attr_reader :planned_task
|
150
|
+
attr_reader :planning_task
|
151
|
+
attr_reader :failure_reason
|
152
|
+
def initialize(planned_task, planning_task, failure_reason)
|
153
|
+
@planned_task = planned_task
|
154
|
+
@planning_task = planning_task
|
155
|
+
@failure_reason = failure_reason
|
156
|
+
end
|
157
|
+
def proxy(peer)
|
158
|
+
planned_task = peer.local_object(self.planned_task)
|
159
|
+
planning_task = peer.local_object(self.planning_task)
|
160
|
+
failure_reason = peer.local_object(self.failure_reason)
|
161
|
+
PlanningFailedError.new(planned_task, planning_task, failure_reason: failure_reason)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
module ExecutionExceptionDumper
|
167
|
+
def droby_dump(peer)
|
168
|
+
DRoby.new(peer.dump(trace),
|
169
|
+
peer.dump(exception),
|
170
|
+
handled)
|
171
|
+
end
|
172
|
+
|
173
|
+
class DRoby
|
174
|
+
attr_reader :trace
|
175
|
+
attr_reader :exception
|
176
|
+
attr_reader :handled
|
177
|
+
|
178
|
+
def initialize(trace, exception, handled)
|
179
|
+
@trace, @exception, @handled = trace, exception, handled
|
180
|
+
end
|
181
|
+
|
182
|
+
def proxy(peer)
|
183
|
+
trace = peer.local_object(self.trace)
|
184
|
+
exception = peer.local_object(self.exception)
|
185
|
+
result = ExecutionException.new(exception)
|
186
|
+
result.trace.replace(trace)
|
187
|
+
result.handled = self.handled
|
188
|
+
result
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
module Models
|
194
|
+
module TaskDumper
|
195
|
+
# Used to tag anything that is extended by TaskDumper as
|
196
|
+
# "ready to be dumped"
|
197
|
+
include ModelDumper
|
198
|
+
|
199
|
+
def droby_dump(peer)
|
200
|
+
arguments = __arguments.each_value.map do |arg|
|
201
|
+
if arg.has_default?
|
202
|
+
[arg.name, true, peer.dump(arg.default), arg.doc]
|
203
|
+
else
|
204
|
+
[arg.name, false, nil, arg.doc]
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
DRoby.new(
|
209
|
+
name,
|
210
|
+
peer.known_siblings_for(self),
|
211
|
+
arguments,
|
212
|
+
DRobyModel.dump_supermodel(peer, self),
|
213
|
+
DRobyModel.dump_provided_models_of(peer, self),
|
214
|
+
each_event.map { |_, ev| [ev.symbol, ev.controlable?, ev.terminal?] })
|
215
|
+
end
|
216
|
+
|
217
|
+
class DRoby < DRobyModel
|
218
|
+
attr_reader :events
|
219
|
+
attr_reader :arguments
|
220
|
+
|
221
|
+
def initialize(name, remote_siblings, arguments, supermodel, provided_models, events)
|
222
|
+
super(name, remote_siblings, supermodel, provided_models)
|
223
|
+
@arguments = arguments
|
224
|
+
@events = events
|
225
|
+
end
|
226
|
+
|
227
|
+
def unmarshal_dependent_models(peer)
|
228
|
+
super
|
229
|
+
|
230
|
+
@arguments.each do |name, has_default, default, doc|
|
231
|
+
if has_default
|
232
|
+
peer.local_object(default)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
def update(peer, local_object, fresh_proxy: false)
|
238
|
+
if @argument_set # Backward compatibility
|
239
|
+
arguments = @argument_set.map { |name| [name, false, nil, nil] }
|
240
|
+
end
|
241
|
+
|
242
|
+
@arguments.each do |name, has_default, default, doc|
|
243
|
+
if !local_object.has_argument?(name)
|
244
|
+
if !has_default
|
245
|
+
default = Roby::Models::Task::NO_DEFAULT_ARGUMENT
|
246
|
+
end
|
247
|
+
local_object.argument name, default: peer.local_object(default), doc: doc
|
248
|
+
end
|
249
|
+
end
|
250
|
+
events.each do |name, controlable, terminal|
|
251
|
+
if !local_object.has_event?(name)
|
252
|
+
local_object.event name, controlable: controlable, terminal: terminal
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
module TaskServiceModelDumper
|
260
|
+
include ModelDumper
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
module DistributedObjectDumper
|
265
|
+
class DRoby
|
266
|
+
# The set of remote siblings for that object, as known by the peer who
|
267
|
+
# called #droby_dump. This is used to match object identity among plan
|
268
|
+
# managers.
|
269
|
+
attr_reader :remote_siblings
|
270
|
+
# The set of owners for that object.
|
271
|
+
attr_reader :owners
|
272
|
+
# Create a DistributedObject::DRoby object with the given information
|
273
|
+
def initialize(remote_siblings, owners)
|
274
|
+
@remote_siblings, @owners = remote_siblings, owners
|
275
|
+
end
|
276
|
+
|
277
|
+
# Update an existing proxy, using the information stored in this DRoby
|
278
|
+
# object.
|
279
|
+
def update(peer, proxy, fresh_proxy: false)
|
280
|
+
proxy.clear_owners
|
281
|
+
owners.each do |m_owner|
|
282
|
+
proxy.add_owner(peer.local_object(m_owner))
|
283
|
+
end
|
284
|
+
end
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
# Base class for all marshalled plan objects.
|
289
|
+
module PlanObjectDumper
|
290
|
+
class DRoby < DistributedObjectDumper::DRoby
|
291
|
+
# The model for this plan object
|
292
|
+
attr_reader :model
|
293
|
+
# The droby_id of this object's plan
|
294
|
+
attr_reader :plan_id
|
295
|
+
|
296
|
+
# Create a DRoby object with the given information
|
297
|
+
#
|
298
|
+
# @see DistributedObject::DRoby
|
299
|
+
def initialize(remote_siblings, owners, model, plan_id)
|
300
|
+
super(remote_siblings, owners)
|
301
|
+
@model, @plan_id = model, plan_id
|
302
|
+
end
|
303
|
+
|
304
|
+
def local_plan(peer)
|
305
|
+
if plan_id
|
306
|
+
peer.local_plan(plan_id)
|
307
|
+
else TemplatePlan.new
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
module EventGeneratorDumper
|
314
|
+
# Returns an intermediate representation of +self+ suitable to be sent
|
315
|
+
# to the +dest+ peer.
|
316
|
+
def droby_dump(peer)
|
317
|
+
DRoby.new(peer.known_siblings_for(self),
|
318
|
+
peer.dump(owners),
|
319
|
+
peer.dump(model),
|
320
|
+
plan.droby_id,
|
321
|
+
controlable?, emitted?)
|
322
|
+
end
|
323
|
+
|
324
|
+
# An intermediate representation of EventGenerator objects suitable to
|
325
|
+
# be sent to our peers.
|
326
|
+
class DRoby < PlanObjectDumper::DRoby
|
327
|
+
# True if the generator is controlable
|
328
|
+
attr_reader :controlable
|
329
|
+
# True if the generator has already been emitted once at the time
|
330
|
+
# EventGenerator#droby_dump has been called.
|
331
|
+
attr_reader :emitted
|
332
|
+
|
333
|
+
# Create a DRoby object with the given information. See also
|
334
|
+
# PlanObject::DRoby
|
335
|
+
def initialize(remote_siblings, owners, model, plan_id, controlable, emitted)
|
336
|
+
super(remote_siblings, owners, model, plan_id)
|
337
|
+
@controlable, @emitted = controlable, emitted
|
338
|
+
end
|
339
|
+
|
340
|
+
# Create a new proxy which maps the object of +peer+ represented by
|
341
|
+
# this communication intermediate.
|
342
|
+
def proxy(peer)
|
343
|
+
local_object = peer.local_object(model).new(plan: local_plan(peer))
|
344
|
+
if controlable
|
345
|
+
local_object.command = lambda { }
|
346
|
+
end
|
347
|
+
local_object
|
348
|
+
end
|
349
|
+
|
350
|
+
# Updates an already existing proxy using the information contained
|
351
|
+
# in this object.
|
352
|
+
def update(peer, proxy, fresh_proxy: false)
|
353
|
+
super
|
354
|
+
|
355
|
+
if emitted && !proxy.emitted?
|
356
|
+
proxy.instance_eval { @emitted = true }
|
357
|
+
end
|
358
|
+
end
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
module EventDumper
|
363
|
+
# Returns an intermediate representation of +self+ suitable to be sent
|
364
|
+
# to the +dest+ peer.
|
365
|
+
def droby_dump(dest)
|
366
|
+
DRoby.new(propagation_id, time, dest.dump(generator), dest.dump(context))
|
367
|
+
end
|
368
|
+
|
369
|
+
class DRoby
|
370
|
+
attr_reader :propagation_id
|
371
|
+
attr_reader :time
|
372
|
+
attr_reader :generator
|
373
|
+
attr_reader :context
|
374
|
+
|
375
|
+
def initialize(propagation_id, time, generator, context)
|
376
|
+
@propagation_id, @time, @generator, @context = propagation_id, time, generator, context
|
377
|
+
end
|
378
|
+
|
379
|
+
def proxy(peer)
|
380
|
+
generator = peer.local_object(self.generator)
|
381
|
+
context = peer.local_object(self.context)
|
382
|
+
generator.new(context, propagation_id, time)
|
383
|
+
end
|
384
|
+
end
|
385
|
+
end
|
386
|
+
|
387
|
+
module TaskEventGeneratorDumper
|
388
|
+
# Returns an intermediate representation of +self+ suitable to be sent
|
389
|
+
# to the +dest+ peer.
|
390
|
+
def droby_dump(peer)
|
391
|
+
DRoby.new(peer.known_siblings_for(self), emitted?, peer.dump(task), symbol)
|
392
|
+
end
|
393
|
+
|
394
|
+
# An intermediate representation of TaskEventGenerator objects suitable
|
395
|
+
# to be sent to our peers.
|
396
|
+
class DRoby
|
397
|
+
# This event's siblings
|
398
|
+
attr_reader :remote_siblings
|
399
|
+
# True if the generator has already emitted once at the time
|
400
|
+
# TaskEventGenerator#droby_dump has been called.
|
401
|
+
attr_reader :emitted
|
402
|
+
# An object representing the task of this generator on our remote
|
403
|
+
# peer.
|
404
|
+
attr_reader :task
|
405
|
+
# The event name
|
406
|
+
attr_reader :symbol
|
407
|
+
|
408
|
+
# Create a new DRoby object with the given information
|
409
|
+
def initialize(remote_siblings, emitted, task, symbol)
|
410
|
+
@remote_siblings = remote_siblings
|
411
|
+
@emitted = emitted
|
412
|
+
@task = task
|
413
|
+
@symbol = symbol
|
414
|
+
end
|
415
|
+
|
416
|
+
def to_s # :nodoc:
|
417
|
+
"#<dRoby:#{task}/#{symbol}>"
|
418
|
+
end
|
419
|
+
|
420
|
+
# Create a new proxy which maps the object of +peer+ represented by
|
421
|
+
# this communication intermediate.
|
422
|
+
def proxy(peer)
|
423
|
+
task = peer.local_object(self.task)
|
424
|
+
event = task.event(symbol)
|
425
|
+
if emitted && !event.emitted?
|
426
|
+
event.instance_eval { @emitted = true }
|
427
|
+
end
|
428
|
+
event
|
429
|
+
end
|
430
|
+
end
|
431
|
+
end
|
432
|
+
|
433
|
+
module DefaultArgumentDumper
|
434
|
+
def droby_dump(peer)
|
435
|
+
DRoby.new(peer.dump(value))
|
436
|
+
end
|
437
|
+
|
438
|
+
class DRoby
|
439
|
+
def initialize(value)
|
440
|
+
@value = value
|
441
|
+
end
|
442
|
+
|
443
|
+
def proxy(peer)
|
444
|
+
DefaultArgument.new(peer.local_object(@value))
|
445
|
+
end
|
446
|
+
end
|
447
|
+
end
|
448
|
+
|
449
|
+
module DelayedArgumentFromObjectDumper
|
450
|
+
def droby_dump(peer)
|
451
|
+
DRoby.new(
|
452
|
+
peer.dump(self.class),
|
453
|
+
peer.dump(@object),
|
454
|
+
@methods,
|
455
|
+
@weak)
|
456
|
+
end
|
457
|
+
|
458
|
+
class DRoby
|
459
|
+
def initialize(klass, object, methods, weak)
|
460
|
+
@klass, @object, @methods, @weak = klass, object, methods, weak
|
461
|
+
end
|
462
|
+
def proxy(peer)
|
463
|
+
base = peer.local_object(@klass).new(peer.local_object(@object), @weak)
|
464
|
+
@methods.inject(base) do |delayed_arg, m|
|
465
|
+
delayed_arg.send(m)
|
466
|
+
end
|
467
|
+
end
|
468
|
+
end
|
469
|
+
end
|
470
|
+
|
471
|
+
module TaskArgumentsDumper
|
472
|
+
class DRoby
|
473
|
+
attr_reader :values
|
474
|
+
def initialize(values)
|
475
|
+
@values = values
|
476
|
+
end
|
477
|
+
|
478
|
+
def proxy(peer)
|
479
|
+
obj = TaskArguments.new(nil)
|
480
|
+
obj.values.merge!(peer.local_object(values))
|
481
|
+
obj
|
482
|
+
end
|
483
|
+
end
|
484
|
+
|
485
|
+
def droby_dump(peer)
|
486
|
+
DRoby.new(peer.dump(values))
|
487
|
+
end
|
488
|
+
end
|
489
|
+
|
490
|
+
module TaskDumper
|
491
|
+
# Returns an intermediate representation of +self+ suitable to be sent
|
492
|
+
# to the +dest+ peer.
|
493
|
+
def droby_dump(peer)
|
494
|
+
arguments = Hash.new
|
495
|
+
model.arguments.each do |arg_name|
|
496
|
+
if self.arguments.assigned?(arg_name)
|
497
|
+
arguments[arg_name] = self.arguments.raw_get(arg_name)
|
498
|
+
end
|
499
|
+
end
|
500
|
+
|
501
|
+
d_model = peer.dump_model(model)
|
502
|
+
d_arguments = peer.dump(arguments)
|
503
|
+
d_data = peer.dump(data)
|
504
|
+
|
505
|
+
DRoby.new(peer.known_siblings_for(self),
|
506
|
+
peer.dump(owners),
|
507
|
+
d_model,
|
508
|
+
plan.droby_id,
|
509
|
+
d_arguments,
|
510
|
+
d_data,
|
511
|
+
mission: mission?, started: started?,
|
512
|
+
finished: finished?, success: success?)
|
513
|
+
end
|
514
|
+
|
515
|
+
# An intermediate representation of Task objects suitable
|
516
|
+
# to be sent to our peers.
|
517
|
+
class DRoby < PlanObjectDumper::DRoby
|
518
|
+
# The set of dRoby-formatted arguments
|
519
|
+
attr_reader :arguments
|
520
|
+
# The task's internal data
|
521
|
+
attr_reader :data
|
522
|
+
# A set of boolean flags which describe the task's status. It is a
|
523
|
+
# symbol => bool flag where the following parameters are save:
|
524
|
+
# started:: if the task has started
|
525
|
+
# finished:: if the task has finished
|
526
|
+
# success:: if the task has finished with success
|
527
|
+
# mission:: if the task is a mission in its plan
|
528
|
+
attr_reader :flags
|
529
|
+
|
530
|
+
# Create a new DRoby object with the given information
|
531
|
+
def initialize(remote_siblings, owners, model, plan_id, arguments, data, **flags)
|
532
|
+
super(remote_siblings, owners, model, plan_id)
|
533
|
+
@arguments, @data, @flags = arguments, data, flags
|
534
|
+
end
|
535
|
+
|
536
|
+
# Create a new proxy which maps the object of +peer+ represented by
|
537
|
+
# this communication intermediate.
|
538
|
+
def proxy(peer)
|
539
|
+
model = peer.local_object(self.model)
|
540
|
+
arguments = peer.local_object(self.arguments)
|
541
|
+
model.new(plan: local_plan(peer), **arguments)
|
542
|
+
end
|
543
|
+
|
544
|
+
# Updates an already existing proxy using the information contained
|
545
|
+
# in this object.
|
546
|
+
def update(peer, task, fresh_proxy: false)
|
547
|
+
super
|
548
|
+
|
549
|
+
task.started = flags[:started]
|
550
|
+
task.finished = flags[:finished]
|
551
|
+
task.success = flags[:success]
|
552
|
+
|
553
|
+
if task.mission? != flags[:mission]
|
554
|
+
if flags[:mission]
|
555
|
+
task.plan.add_mission_task(task)
|
556
|
+
else
|
557
|
+
task.plan.unmark_mission_task(task)
|
558
|
+
end
|
559
|
+
end
|
560
|
+
|
561
|
+
if !fresh_proxy
|
562
|
+
task.arguments.merge!(peer.local_object(arguments))
|
563
|
+
end
|
564
|
+
task.instance_variable_set("@data", peer.local_object(data))
|
565
|
+
end
|
566
|
+
end
|
567
|
+
end
|
568
|
+
|
569
|
+
module PlanDumper
|
570
|
+
def droby_dump(peer)
|
571
|
+
peer.dump_groups(tasks, task_events, free_events) do |tasks, task_events, free_events|
|
572
|
+
mission_tasks = peer.dump(self.mission_tasks)
|
573
|
+
permanent_tasks = peer.dump(self.permanent_tasks)
|
574
|
+
permanent_events = peer.dump(self.permanent_events)
|
575
|
+
task_relation_graphs = each_task_relation_graph.map do |g|
|
576
|
+
edges = peer.dump(g.each_edge.flat_map { |*args| args })
|
577
|
+
[peer.dump_model(g.class), edges]
|
578
|
+
end
|
579
|
+
event_relation_graphs = each_event_relation_graph.map do |g|
|
580
|
+
edges = peer.dump(g.each_edge.flat_map { |*args| args })
|
581
|
+
[peer.dump_model(g.class), edges]
|
582
|
+
end
|
583
|
+
|
584
|
+
DRoby.new(
|
585
|
+
DRobyConstant.new(self.class), droby_id,
|
586
|
+
tasks, task_events, free_events,
|
587
|
+
mission_tasks, permanent_tasks, permanent_events,
|
588
|
+
task_relation_graphs, event_relation_graphs)
|
589
|
+
end
|
590
|
+
end
|
591
|
+
|
592
|
+
class DRoby
|
593
|
+
attr_reader :plan_class
|
594
|
+
attr_reader :droby_id
|
595
|
+
attr_reader :groups
|
596
|
+
attr_reader :tasks
|
597
|
+
attr_reader :task_events
|
598
|
+
attr_reader :free_events
|
599
|
+
attr_reader :mission_tasks
|
600
|
+
attr_reader :permanent_tasks
|
601
|
+
attr_reader :permanent_events
|
602
|
+
attr_reader :task_relation_graphs
|
603
|
+
attr_reader :event_relation_graphs
|
604
|
+
|
605
|
+
def initialize(plan_class, droby_id,
|
606
|
+
tasks, task_events, free_events,
|
607
|
+
mission_tasks, permanent_tasks, permanent_events,
|
608
|
+
task_relation_graphs, event_relation_graphs)
|
609
|
+
@plan_class = plan_class
|
610
|
+
@droby_id = droby_id
|
611
|
+
@tasks = tasks
|
612
|
+
@task_events = task_events
|
613
|
+
@free_events = free_events
|
614
|
+
@mission_tasks = mission_tasks
|
615
|
+
@permanent_tasks = permanent_tasks
|
616
|
+
@permanent_events = permanent_events
|
617
|
+
@task_relation_graphs = task_relation_graphs
|
618
|
+
@event_relation_graphs = event_relation_graphs
|
619
|
+
end
|
620
|
+
|
621
|
+
def proxy(peer)
|
622
|
+
plan = Plan.new
|
623
|
+
peer.with_object(droby_id => plan) do
|
624
|
+
peer.load_groups(tasks, task_events, free_events) do |tasks, task_events, free_events|
|
625
|
+
plan.tasks.merge(tasks)
|
626
|
+
plan.task_events.merge(task_events)
|
627
|
+
plan.free_events.merge(free_events)
|
628
|
+
|
629
|
+
plan.mission_tasks.replace(peer.local_object(mission_tasks))
|
630
|
+
plan.permanent_tasks.replace(peer.local_object(permanent_tasks))
|
631
|
+
plan.permanent_events.replace(peer.local_object(permanent_events))
|
632
|
+
|
633
|
+
task_relation_graphs.each do |rel_id, edges|
|
634
|
+
rel = peer.local_object(rel_id)
|
635
|
+
g = plan.task_relation_graph_for(rel)
|
636
|
+
peer.local_object(edges).each_slice(3) do |from, to, info|
|
637
|
+
g.add_edge(from, to, info)
|
638
|
+
end
|
639
|
+
end
|
640
|
+
event_relation_graphs.each do |rel_id, edges|
|
641
|
+
rel = peer.local_object(rel_id)
|
642
|
+
g = plan.event_relation_graph_for(rel)
|
643
|
+
peer.local_object(edges).each_slice(3) do |from, to, info|
|
644
|
+
g.add_edge(from, to, info)
|
645
|
+
end
|
646
|
+
end
|
647
|
+
end
|
648
|
+
end
|
649
|
+
plan
|
650
|
+
end
|
651
|
+
end
|
652
|
+
end
|
653
|
+
|
654
|
+
module Actions
|
655
|
+
module ActionDumper
|
656
|
+
def droby_dump(peer)
|
657
|
+
result = dup
|
658
|
+
result.droby_dump!(peer)
|
659
|
+
result
|
660
|
+
end
|
661
|
+
|
662
|
+
def droby_dump!(peer)
|
663
|
+
@model = peer.dump(model)
|
664
|
+
@arguments = peer.dump(arguments)
|
665
|
+
end
|
666
|
+
|
667
|
+
def proxy(peer)
|
668
|
+
result = dup
|
669
|
+
result.proxy!(peer)
|
670
|
+
result
|
671
|
+
end
|
672
|
+
|
673
|
+
def proxy!(peer)
|
674
|
+
@model = peer.local_object(model)
|
675
|
+
@arguments = peer.local_object(arguments)
|
676
|
+
end
|
677
|
+
end
|
678
|
+
|
679
|
+
module Models
|
680
|
+
module ActionDumper
|
681
|
+
def droby_dump(dest)
|
682
|
+
dump = self.dup
|
683
|
+
dump.droby_dump!(dest)
|
684
|
+
dump
|
685
|
+
end
|
686
|
+
|
687
|
+
def droby_dump!(peer)
|
688
|
+
@returned_type = peer.dump_model(returned_type)
|
689
|
+
@arguments = peer.dump(arguments)
|
690
|
+
# This is a cached value, invalidate it
|
691
|
+
@returned_task_type = nil
|
692
|
+
end
|
693
|
+
|
694
|
+
def proxy(peer)
|
695
|
+
result = self.dup
|
696
|
+
result.proxy!(peer)
|
697
|
+
result
|
698
|
+
end
|
699
|
+
|
700
|
+
def proxy!(peer)
|
701
|
+
@returned_type = peer.local_model(returned_type)
|
702
|
+
@arguments = peer.local_object(arguments)
|
703
|
+
end
|
704
|
+
end
|
705
|
+
|
706
|
+
module InterfaceActionDumper
|
707
|
+
def droby_dump!(peer)
|
708
|
+
super
|
709
|
+
@action_interface_model = peer.dump(action_interface_model)
|
710
|
+
end
|
711
|
+
|
712
|
+
def proxy_from_existing(peer)
|
713
|
+
interface_model = peer.local_object(@action_interface_model)
|
714
|
+
if action = interface_model.find_action_by_name(name)
|
715
|
+
# Load the return type and the default values, we must
|
716
|
+
# make sure that any dumped droby-identifiable object
|
717
|
+
# is loaded nonetheless
|
718
|
+
peer.local_model(returned_type)
|
719
|
+
arguments.each { |arg| peer.local_object(arg.default) }
|
720
|
+
end
|
721
|
+
return action, interface_model
|
722
|
+
end
|
723
|
+
end
|
724
|
+
|
725
|
+
module MethodActionDumper
|
726
|
+
include InterfaceActionDumper
|
727
|
+
|
728
|
+
def proxy(peer, resolve_existing: true)
|
729
|
+
if resolve_existing
|
730
|
+
existing, _interface_model = proxy_from_existing(peer)
|
731
|
+
if existing
|
732
|
+
return existing
|
733
|
+
end
|
734
|
+
end
|
735
|
+
|
736
|
+
interface_model = peer.local_object(@action_interface_model)
|
737
|
+
action = super(peer)
|
738
|
+
action.action_interface_model = interface_model
|
739
|
+
action
|
740
|
+
end
|
741
|
+
end
|
742
|
+
|
743
|
+
module CoordinationActionDumper
|
744
|
+
include InterfaceActionDumper
|
745
|
+
|
746
|
+
def proxy(peer)
|
747
|
+
existing, interface_model = proxy_from_existing(peer)
|
748
|
+
if existing
|
749
|
+
return existing
|
750
|
+
else
|
751
|
+
action = super(peer)
|
752
|
+
action.coordination_model =
|
753
|
+
interface_model.create_coordination_model(action, Coordination::Actions) {}
|
754
|
+
action
|
755
|
+
end
|
756
|
+
end
|
757
|
+
|
758
|
+
def droby_dump!(peer)
|
759
|
+
super
|
760
|
+
@coordination_model = nil
|
761
|
+
end
|
762
|
+
end
|
763
|
+
|
764
|
+
class Action
|
765
|
+
module ArgumentDumper
|
766
|
+
def droby_dump(peer)
|
767
|
+
result = self.dup
|
768
|
+
result.droby_dump!(peer)
|
769
|
+
result
|
770
|
+
end
|
771
|
+
|
772
|
+
def droby_dump!(peer)
|
773
|
+
self.default = peer.dump(default)
|
774
|
+
end
|
775
|
+
|
776
|
+
def proxy(peer)
|
777
|
+
result = dup
|
778
|
+
result.proxy!(peer)
|
779
|
+
result
|
780
|
+
end
|
781
|
+
|
782
|
+
def proxy!(peer)
|
783
|
+
self.default = peer.local_object(default)
|
784
|
+
end
|
785
|
+
end
|
786
|
+
end
|
787
|
+
end
|
788
|
+
end
|
789
|
+
|
790
|
+
module Queries
|
791
|
+
module AndMatcherDumper
|
792
|
+
# An intermediate representation of AndMatcher objects suitable to
|
793
|
+
# be sent to our peers.
|
794
|
+
class DRoby
|
795
|
+
attr_reader :ops
|
796
|
+
def initialize(ops)
|
797
|
+
@ops = ops
|
798
|
+
end
|
799
|
+
def proxy(peer)
|
800
|
+
Roby::Queries::AndMatcher.new(*peer.local_object(ops))
|
801
|
+
end
|
802
|
+
end
|
803
|
+
|
804
|
+
# Returns an intermediate representation of +self+ suitable to be sent
|
805
|
+
# to the +dest+ peer.
|
806
|
+
def droby_dump(peer)
|
807
|
+
DRoby.new(peer.dump(@ops))
|
808
|
+
end
|
809
|
+
end
|
810
|
+
|
811
|
+
module NotMatcherDumper
|
812
|
+
# An intermediate representation of NegateTaskMatcher objects suitable to
|
813
|
+
# be sent to our peers.
|
814
|
+
class DRoby
|
815
|
+
def initialize(op)
|
816
|
+
@op = op
|
817
|
+
end
|
818
|
+
def proxy(peer)
|
819
|
+
Roby::Queries::NotMatcher.new(peer.local_object(@op))
|
820
|
+
end
|
821
|
+
end
|
822
|
+
|
823
|
+
# Returns an intermediate representation of +self+ suitable to be sent
|
824
|
+
# to the +dest+ peer.
|
825
|
+
def droby_dump(peer)
|
826
|
+
DRoby.new(peer.dump(@op))
|
827
|
+
end
|
828
|
+
end
|
829
|
+
|
830
|
+
module OrMatcherDumper
|
831
|
+
# An intermediate representation of OrMatcher objects suitable to
|
832
|
+
# be sent to our peers.
|
833
|
+
class DRoby
|
834
|
+
attr_reader :ops
|
835
|
+
def initialize(ops)
|
836
|
+
@ops = ops
|
837
|
+
end
|
838
|
+
def proxy(peer)
|
839
|
+
Roby::Queries::OrMatcher.new(*peer.local_object(ops))
|
840
|
+
end
|
841
|
+
end
|
842
|
+
|
843
|
+
# Returns an intermediate representation of +self+ suitable to be sent
|
844
|
+
# to the +dest+ peer.
|
845
|
+
def droby_dump(dest)
|
846
|
+
DRoby.new(dest.dump(@ops))
|
847
|
+
end
|
848
|
+
end
|
849
|
+
|
850
|
+
module ExecutionExceptionMatcherDumper
|
851
|
+
# An intermediate representation of ExecutionExceptionMatcher objects suitable to
|
852
|
+
# be sent to our peers.
|
853
|
+
class DRoby
|
854
|
+
attr_reader :exception_matcher, :involved_tasks_matchers
|
855
|
+
def initialize(exception_matchers, involved_tasks_matchers)
|
856
|
+
@exception_matcher = exception_matcher
|
857
|
+
@involved_tasks_matchers = involved_tasks_matchers
|
858
|
+
end
|
859
|
+
def proxy(peer)
|
860
|
+
matcher = Roby::Queries::ExecutionExceptionMatcher.new
|
861
|
+
matcher.with_exception(peer.local_object(exception_matcher))
|
862
|
+
involved_tasks_matchers.each do |m|
|
863
|
+
matcher.involving(peer.local_object(m))
|
864
|
+
end
|
865
|
+
matcher
|
866
|
+
end
|
867
|
+
end
|
868
|
+
|
869
|
+
# Returns an intermediate representation of +self+ suitable to be sent
|
870
|
+
# to the +dest+ peer.
|
871
|
+
def droby_dump(peer)
|
872
|
+
DRoby.new(
|
873
|
+
peer.dump(exception_matcher),
|
874
|
+
peer.dump(involved_tasks_matchers))
|
875
|
+
end
|
876
|
+
end
|
877
|
+
|
878
|
+
module LocalizedErrorMatcherDumper
|
879
|
+
# An intermediate representation of OrMatcher objects suitable to
|
880
|
+
# be sent to our peers.
|
881
|
+
class DRoby
|
882
|
+
attr_reader :model, :failure_point_matcher
|
883
|
+
def initialize(model, failure_point_matcher)
|
884
|
+
@model = model
|
885
|
+
@failure_point_matcher = failure_point_matcher
|
886
|
+
end
|
887
|
+
def proxy(peer)
|
888
|
+
matcher = Roby::Queries::LocalizedErrorMatcher.new
|
889
|
+
matcher.with_model(peer.local_model(model))
|
890
|
+
matcher.with_origin(peer.local_object(failure_point_matcher))
|
891
|
+
matcher
|
892
|
+
end
|
893
|
+
end
|
894
|
+
|
895
|
+
# Returns an intermediate representation of +self+ suitable to be sent
|
896
|
+
# to the +dest+ peer.
|
897
|
+
def droby_dump(peer)
|
898
|
+
DRoby.new(
|
899
|
+
peer.dump_model(model),
|
900
|
+
peer.dump(failure_point_matcher))
|
901
|
+
end
|
902
|
+
end
|
903
|
+
|
904
|
+
module PlanObjectMatcherDumper
|
905
|
+
# An intermediate representation of TaskMatcher objects suitable to be
|
906
|
+
# sent to our peers.
|
907
|
+
class DRoby
|
908
|
+
# The exact match class that has been marshalled using this object
|
909
|
+
attr_reader :model
|
910
|
+
attr_reader :predicates
|
911
|
+
attr_reader :neg_predicates
|
912
|
+
attr_reader :indexed_predicates
|
913
|
+
attr_reader :indexed_neg_predicates
|
914
|
+
attr_reader :parents
|
915
|
+
attr_reader :children
|
916
|
+
attr_reader :owners
|
917
|
+
|
918
|
+
def initialize(model, predicates, neg_predicates, indexed_predicates, indexed_neg_predicates, owners, parents, children)
|
919
|
+
@model = model
|
920
|
+
@predicates, @neg_predicates, @indexed_predicates, @indexed_neg_predicates =
|
921
|
+
predicates, neg_predicates, indexed_predicates, indexed_neg_predicates
|
922
|
+
@owners = owners
|
923
|
+
@parents = parents
|
924
|
+
@children = children
|
925
|
+
end
|
926
|
+
|
927
|
+
# Common initialization of a TaskMatcher object from the given
|
928
|
+
# argument set. This is to be used by DRoby-dumped versions of
|
929
|
+
# subclasses of TaskMatcher.
|
930
|
+
def proxy(peer, matcher: Roby::Queries::PlanObjectMatcher.new)
|
931
|
+
model = self.model.map { |m| peer.local_model(m) }
|
932
|
+
owners = peer.local_object(self.owners)
|
933
|
+
|
934
|
+
matcher.with_model(model)
|
935
|
+
matcher.predicates.concat(predicates)
|
936
|
+
matcher.neg_predicates.concat(neg_predicates)
|
937
|
+
matcher.indexed_predicates.concat(indexed_predicates)
|
938
|
+
matcher.indexed_neg_predicates.concat(indexed_neg_predicates)
|
939
|
+
matcher.parents.merge!(peer.local_object(parents))
|
940
|
+
matcher.children.merge!(peer.local_object(children))
|
941
|
+
matcher.owners.concat(owners)
|
942
|
+
matcher
|
943
|
+
end
|
944
|
+
end
|
945
|
+
|
946
|
+
# Returns an intermediate representation of +self+ suitable to be sent
|
947
|
+
# to the +dest+ peer. +klass+ is the actual class of the intermediate
|
948
|
+
# representation. It is used for code reuse by subclasses of
|
949
|
+
# TaskMatcher.
|
950
|
+
def droby_dump(peer, droby: DRoby)
|
951
|
+
droby.new(model.map { |m| peer.dump_model(m) },
|
952
|
+
predicates, neg_predicates, indexed_predicates, indexed_neg_predicates,
|
953
|
+
peer.dump(owners),
|
954
|
+
peer.dump(parents), peer.dump(children))
|
955
|
+
end
|
956
|
+
end
|
957
|
+
|
958
|
+
module TaskMatcherDumper
|
959
|
+
# An intermediate representation of TaskMatcher objects suitable to be
|
960
|
+
# sent to our peers.
|
961
|
+
class DRoby < PlanObjectMatcherDumper::DRoby
|
962
|
+
attr_reader :arguments
|
963
|
+
|
964
|
+
def initialize(*args)
|
965
|
+
@arguments = Hash.new
|
966
|
+
super(*args)
|
967
|
+
end
|
968
|
+
|
969
|
+
def proxy(peer, matcher: Roby::Queries::TaskMatcher.new)
|
970
|
+
super(peer, matcher: matcher)
|
971
|
+
matcher.arguments.merge!(arguments.proxy(peer))
|
972
|
+
matcher
|
973
|
+
end
|
974
|
+
end
|
975
|
+
|
976
|
+
# Returns an intermediate representation of +self+ suitable to be sent
|
977
|
+
# to the +dest+ peer. +klass+ is the actual class of the intermediate
|
978
|
+
# representation. It is used for code reuse by subclasses of
|
979
|
+
# TaskMatcher.
|
980
|
+
def droby_dump(peer, droby: DRoby)
|
981
|
+
droby = super(peer, droby: droby)
|
982
|
+
droby.arguments.merge!(peer.dump(arguments))
|
983
|
+
droby
|
984
|
+
end
|
985
|
+
end
|
986
|
+
|
987
|
+
module QueryDumper
|
988
|
+
# An intermediate representation of Query objects suitable to be sent
|
989
|
+
# to our peers.
|
990
|
+
class DRoby < TaskMatcherDumper::DRoby
|
991
|
+
attr_accessor :plan_id
|
992
|
+
attr_accessor :scope
|
993
|
+
attr_reader :plan_predicates, :neg_plan_predicates
|
994
|
+
def initialize(*args)
|
995
|
+
super
|
996
|
+
@plan_predicates, @neg_plan_predicates = Set.new, Set.new
|
997
|
+
end
|
998
|
+
|
999
|
+
def proxy(peer)
|
1000
|
+
query = peer.local_plan(plan_id).find_tasks
|
1001
|
+
super(peer, matcher: query)
|
1002
|
+
query.plan_predicates.merge(plan_predicates)
|
1003
|
+
query.neg_plan_predicates.merge(neg_plan_predicates)
|
1004
|
+
if scope == :local
|
1005
|
+
query.local_scope
|
1006
|
+
else query.global_scope
|
1007
|
+
end
|
1008
|
+
query
|
1009
|
+
end
|
1010
|
+
end
|
1011
|
+
|
1012
|
+
# Returns an intermediate representation of +self+ suitable to be sent
|
1013
|
+
# to the +dest+ peer.
|
1014
|
+
def droby_dump(peer)
|
1015
|
+
droby = super(peer, droby: DRoby)
|
1016
|
+
droby.plan_id = plan.droby_id
|
1017
|
+
droby.scope = scope
|
1018
|
+
droby.plan_predicates.merge(plan_predicates)
|
1019
|
+
droby.neg_plan_predicates.merge(neg_plan_predicates)
|
1020
|
+
droby
|
1021
|
+
end
|
1022
|
+
end
|
1023
|
+
end
|
1024
|
+
end
|
1025
|
+
end
|
1026
|
+
end
|