Class: Roby::Actions::Task
Overview
A task that calls an action interface to generate a plan
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
The planner result.
-
#transaction ⇒ Transaction
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.
Instance Method Summary collapse
-
#action_arguments ⇒ Hash
The arguments for the action method.
-
#action_interface_model ⇒ Model<Interface>
The action interface model used by this planner.
-
#action_model ⇒ Models::Action
The action itself.
- #job_name ⇒ Object
-
#planned_model ⇒ Model<Roby::Task>
The model of the roby task that is going to represent the action in the plan.
- #planning_result_task ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#result ⇒ Object (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 |
#transaction ⇒ Transaction (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
15 16 17 |
# File 'lib/roby/actions/task.rb', line 15 def transaction @transaction end |
Instance Method Details
#action_arguments ⇒ Hash
The arguments for the action method
25 |
# File 'lib/roby/actions/task.rb', line 25 argument :action_arguments, default: {} |
#action_interface_model ⇒ Model<Interface>
The action interface model used by this planner
36 37 38 |
# File 'lib/roby/actions/task.rb', line 36 def action_interface_model action_model.action_interface_model end |
#action_model ⇒ Models::Action
The action itself
22 |
# File 'lib/roby/actions/task.rb', line 22 argument :action_model |
#job_name ⇒ Object
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_model ⇒ Model<Roby::Task>
The model of the roby task that is going to represent the action in the plan
30 31 32 |
# File 'lib/roby/actions/task.rb', line 30 def planned_model action_model.returned_task_type end |
#planning_result_task ⇒ Object
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_s ⇒ Object
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 |