Class: Roby::Coordination::Models::TaskFromInstanciationObject

Inherits:
TaskWithDependencies show all
Defined in:
lib/roby/coordination/models/task_from_instanciation_object.rb

Overview

Definition of a state from an object that responds to instanciate

Instance Attribute Summary collapse

Attributes inherited from TaskWithDependencies

#dependencies

Attributes inherited from Task

#model, #name

Instance Method Summary collapse

Methods inherited from TaskWithDependencies

#depends_on, #find_child_model, #initialize_copy, #map_tasks

Methods inherited from Task

#can_resolve_child_models?, #find_child, #find_child_model, #find_event, #find_through_method_missing, #has_child?, #has_event?, #has_through_method_missing?, #map_tasks, #new, #rebind, #setup_instanciated_task, #to_coordination_task

Constructor Details

#initialize(instanciation_object, task_model) ⇒ TaskFromInstanciationObject

Returns a new instance of TaskFromInstanciationObject.

Parameters:

  • instanciation_object (#instanciate)

    this object will be used to generate the task that will perform the state’s action. It will be called with #instanciate(plan)

  • task_model (Model<Roby::Task>)

    the model of the task returned by the instanciation object



17
18
19
20
# File 'lib/roby/coordination/models/task_from_instanciation_object.rb', line 17

def initialize(instanciation_object, task_model)
    super(task_model)
    @instanciation_object = instanciation_object
end

Instance Attribute Details

#instanciation_object#instanciate (readonly)

Returns the object that will be used to generate the state’s task when needed.

Returns:

  • (#instanciate)

    the object that will be used to generate the state’s task when needed



10
11
12
# File 'lib/roby/coordination/models/task_from_instanciation_object.rb', line 10

def instanciation_object
  @instanciation_object
end

Instance Method Details

#instanciate(plan, variables = {}) ⇒ Object

Called by the state machine implementation to create a Roby::Task instance that will perform the state’s actions



24
25
26
# File 'lib/roby/coordination/models/task_from_instanciation_object.rb', line 24

def instanciate(plan, variables = {})
    instanciation_object.instanciate(plan)
end

#to_sObject



28
29
30
# File 'lib/roby/coordination/models/task_from_instanciation_object.rb', line 28

def to_s
    "#{instanciation_object}[#{model}]"
end