Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/goldhoorn/tools-roby
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Aug 29, 2014
2 parents d23f00e + 23a3a6a commit ade67ce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
5 changes: 5 additions & 0 deletions lib/roby/coordination/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 10 additions & 4 deletions lib/roby/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def initialize(arguments = Hash.new) #:yields: task_object

@poll_handlers = []
@execute_handlers = []
@coordination_objects = []

yield(self) if block_given?

Expand Down Expand Up @@ -664,9 +665,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}."
Expand Down Expand Up @@ -705,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?
Expand Down

0 comments on commit ade67ce

Please sign in to comment.