class Roby::Coordination::Models::TaskFromAction

A representation of a state based on an action

Attributes

action[RW]

The associated action @return [Roby::Actions::Action]

Public Class Methods

new(action) click to toggle source
Calls superclass method
# File lib/roby/coordination/models/task_from_action.rb, line 11
def initialize(action)
    @action = action
    super(action.model.returned_type)
end

Public Instance Methods

action_coordination_model() click to toggle source

Returns the action's underlying coordination model if there is one

@return [nil,Base]

# File lib/roby/coordination/models/task_from_action.rb, line 39
def action_coordination_model
    if action.model.respond_to?(:coordination_model)
        action.model.coordination_model
    end
end
instanciate(plan, variables = Hash.new) click to toggle source

Generates a task for this state in the given plan and returns it

# File lib/roby/coordination/models/task_from_action.rb, line 26
def instanciate(plan, variables = Hash.new)
    arguments = action.arguments.map_value do |key, value|
        if value.respond_to?(:evaluate)
            value.evaluate(variables)
        else value
        end
    end
    action.as_plan(arguments)
end
rebind(coordination_model) click to toggle source

Rebind this task to refer to a different action interface

Calls superclass method
# File lib/roby/coordination/models/task_from_action.rb, line 17
def rebind(coordination_model)
    result = super
    result.action = action.rebind(coordination_model.action_interface)
    result.model  = result.action.model.returned_type
    result
end
to_s() click to toggle source
# File lib/roby/coordination/models/task_from_action.rb, line 45
def to_s; "action(#{action})[#{model}]" end