From 6a451b42726a52cc6a883a71ebf747568051382b Mon Sep 17 00:00:00 2001 From: Matthias Goldhoorn Date: Thu, 10 Jul 2014 14:34:19 +0200 Subject: [PATCH 1/2] Removed failure state if task is not started --- lib/roby/task.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/roby/task.rb b/lib/roby/task.rb index 73b9f1cfc..5ff0dd803 100644 --- a/lib/roby/task.rb +++ b/lib/roby/task.rb @@ -664,9 +664,6 @@ def emitting_event(event, context) # :nodoc: if finished? && !event.terminal? raise EmissionFailed.new(nil, event), "#{self}.emit(#{event.symbol}, #{context}) called by #{plan.engine.propagation_sources.to_a} but the task has finished. Task has been terminated by #{event(:stop).history.first.sources}." - elsif pending? && event.symbol != :start - raise EmissionFailed.new(nil, event), - "#{self}.emit(#{event.symbol}, #{context}) called by #{plan.engine.propagation_sources.to_a} but the task has never been started" elsif running? && event.symbol == :start raise EmissionFailed.new(nil, event), "#{self}.emit(#{event.symbol}, #{context}) called by #{plan.engine.propagation_sources.to_a} but the task is already running. Task has been started by #{event(:start).history.first.sources}." From 23a3a6afb094b2d38842623583e7a09b5849f25c Mon Sep 17 00:00:00 2001 From: Matthias Goldhoorn Date: Wed, 27 Aug 2014 08:24:38 +0200 Subject: [PATCH 2/2] Register coordination objects on the root task --- lib/roby/coordination/base.rb | 5 +++++ lib/roby/task.rb | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/roby/coordination/base.rb b/lib/roby/coordination/base.rb index 7f239b45d..63ffadf59 100644 --- a/lib/roby/coordination/base.rb +++ b/lib/roby/coordination/base.rb @@ -70,6 +70,11 @@ def initialize(root_task = nil, arguments = Hash.new, options = Hash.new) attach_fault_response_tables_to(new_task) end end + + #We register ourself at the rreffering roby task to + #get a access to us. + root_task.register_coordination_object(self) + end end diff --git a/lib/roby/task.rb b/lib/roby/task.rb index 5ff0dd803..cbcbfc8ab 100644 --- a/lib/roby/task.rb +++ b/lib/roby/task.rb @@ -185,6 +185,7 @@ def initialize(arguments = Hash.new) #:yields: task_object @poll_handlers = [] @execute_handlers = [] + @coordination_objects = [] yield(self) if block_given? @@ -702,7 +703,15 @@ def fired_event(event) # # It is only much more efficient attr_reader :failure_event - + + # Reference to the coordinating task if this Roby::Task is handled by a coordination + # object like Statemachiens or ActionScripts + attr_reader :coordination_objects + + def register_coordination_object(object) + coordination_objects << object + end + # Call to update the task status because of +event+ def update_task_status(event) # :nodoc: if event.success?