Class: Roby::Actions::Models::CoordinationAction
- Defined in:
- lib/roby/actions/models/coordination_action.rb,
lib/roby/droby/enable.rb
Overview
Action defined by a coordination model
Constant Summary collapse
- None =
Object.new
Constants inherited from Action
Action::Void, Action::VoidClass
Instance Attribute Summary collapse
-
#coordination_model ⇒ nil, Coordination::Models::Base
If this action is actually a coordination model, returns it.
Attributes inherited from Action
#arguments, #doc, #name, #returned_type
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#action_interface_model ⇒ Object
The underlying action interface model.
-
#initialize(coordination_model, doc = nil) ⇒ CoordinationAction
constructor
A new instance of CoordinationAction.
- #instanciate(plan, arguments = {}) ⇒ Object
-
#plan_pattern(job_id: None, **action_arguments) ⇒ Object
Returns the plan pattern that will deploy this action on the plan.
-
#rebind(action_interface_model) ⇒ Action
Create a new action model that is bound to a different interface model.
- #to_s ⇒ Object
Methods included from DRoby::V5::Actions::Models::CoordinationActionDumper
Methods included from DRoby::V5::Actions::Models::InterfaceActionDumper
#droby_dump!, #proxy_from_existing
Methods inherited from Action
#advanced, #as_plan, #each_arg, #find_arg, #has_arg?, #has_required_arg?, #initialize_copy, #new, #normalize_arguments, #optional_arg, #overloads, #pretty_print, #pretty_print_arguments, #required_arg, #returned_task_type, #returns, #to_action, #to_action_model, #validate_can_overload
Methods included from DRoby::V5::Actions::Models::ActionDumper
#droby_dump, #droby_dump!, #proxy, #proxy!
Constructor Details
#initialize(coordination_model, doc = nil) ⇒ CoordinationAction
Returns a new instance of CoordinationAction.
13 14 15 16 |
# File 'lib/roby/actions/models/coordination_action.rb', line 13 def initialize(coordination_model, doc = nil) super(doc) @coordination_model = coordination_model end |
Instance Attribute Details
#coordination_model ⇒ nil, Coordination::Models::Base
If this action is actually a coordination model, returns it
11 12 13 |
# File 'lib/roby/actions/models/coordination_action.rb', line 11 def coordination_model @coordination_model end |
Instance Method Details
#==(other) ⇒ Object
23 24 25 26 |
# File 'lib/roby/actions/models/coordination_action.rb', line 23 def ==(other) other.kind_of?(self.class) && other.coordination_model == coordination_model end |
#action_interface_model ⇒ Object
The underlying action interface model
19 20 21 |
# File 'lib/roby/actions/models/coordination_action.rb', line 19 def action_interface_model coordination_model.action_interface end |
#instanciate(plan, arguments = {}) ⇒ Object
38 39 40 41 42 |
# File 'lib/roby/actions/models/coordination_action.rb', line 38 def instanciate(plan, arguments = {}) plan.add(root = coordination_model.task_model.new) coordination_model.new(root, arguments) root end |
#plan_pattern(job_id: None, **action_arguments) ⇒ Object
Returns the plan pattern that will deploy this action on the plan
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/roby/actions/models/coordination_action.rb', line 47 def plan_pattern(job_id: None, **action_arguments) job_id = ({ job_id: job_id } if job_id != None) arguments = { action_model: self, action_arguments: action_arguments }.merge(job_id || {}) planner = Roby::Actions::Task.new(**arguments) planner.planning_result_task end |
#rebind(action_interface_model) ⇒ Action
Create a new action model that is bound to a different interface model
29 30 31 32 33 34 35 36 |
# File 'lib/roby/actions/models/coordination_action.rb', line 29 def rebind(action_interface_model) rebound = dup if action_interface_model < self.action_interface_model rebound.coordination_model = coordination_model .rebind(action_interface_model) end rebound end |
#to_s ⇒ Object
58 59 60 |
# File 'lib/roby/actions/models/coordination_action.rb', line 58 def to_s "#{action_interface_model.name}.#{name}[#{coordination_model}]" end |