Class: Roby::Actions::Task

Inherits:
Task
  • Object
show all
Defined in:
lib/roby/actions/task.rb

Overview

A task that calls an action interface to generate a plan

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#resultObject (readonly)

The planner result. It is either an exception or a task object



18
19
20
# File 'lib/roby/actions/task.rb', line 18

def result
  @result
end

#transactionTransaction (readonly)

Once the task has been started, this is the transaction object that is being used / has been used to generate before committing in the plan

Returns:



15
16
17
# File 'lib/roby/actions/task.rb', line 15

def transaction
  @transaction
end

Instance Method Details

#action_argumentsHash

The arguments for the action method

Returns:

  • (Hash)


25
# File 'lib/roby/actions/task.rb', line 25

argument :action_arguments, default: {}

#action_interface_modelModel<Interface>

The action interface model used by this planner

Returns:



36
37
38
# File 'lib/roby/actions/task.rb', line 36

def action_interface_model
    action_model.action_interface_model
end

#action_modelModels::Action

The action itself

Returns:



22
# File 'lib/roby/actions/task.rb', line 22

argument :action_model

#job_nameObject



40
41
42
43
44
45
# File 'lib/roby/actions/task.rb', line 40

def job_name
    formatted_arguments = (action_arguments || {}).map do |k, v|
        "#{k} => #{v}"
    end.join(", ")
    "#{action_model}(#{formatted_arguments})"
end

#planned_modelModel<Roby::Task>

The model of the roby task that is going to represent the action in the plan

Returns:



30
31
32
# File 'lib/roby/actions/task.rb', line 30

def planned_model
    action_model.returned_task_type
end

#planning_result_taskObject



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/roby/actions/task.rb', line 55

def planning_result_task
    if success? || result
        result
    elsif task = planned_tasks.find { true }
        task
    elsif pending?
        task = planned_model.new
        task.planned_by self
        task.abstract = true
        task
    end
end

#to_sObject



47
48
49
50
51
52
53
# File 'lib/roby/actions/task.rb', line 47

def to_s
    if action_model
        "#{super}[#{action_interface_model}:#{action_model}](#{action_arguments}) -> #{action_model.returned_type}"
    else
        super.to_s
    end
end