Module: Roby::TaskStructure::PlannedBy::Extension
- Defined in:
- lib/roby/task_structure/planned_by.rb
Instance Method Summary collapse
-
#planned_by(task, replace: false, optional: false, plan_early: true) ⇒ Object
Set
task
as the planning task ofself
. -
#planned_task ⇒ Object
Returns the first child enumerated by planned_tasks.
-
#planned_tasks ⇒ Object
The set of tasks which are planned by this one.
Instance Method Details
#planned_by(task, replace: false, optional: false, plan_early: true) ⇒ Object
Set task
as the planning task of self
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/roby/task_structure/planned_by.rb', line 25 def planned_by(task, replace: false, optional: false, plan_early: true) if task.respond_to?(:as_plan) task = task.as_plan end if old = planning_task if replace remove_planning_task(old) else raise ArgumentError, "this task already has a planner" end end add_planning_task(task, optional: optional, plan_early: true) unless plan_early task.schedule_as(self) end task end |
#planned_task ⇒ Object
Returns the first child enumerated by planned_tasks. This is a convenience method that can be used if it is known that the planning task is only planning for one single task (a pretty common case)
15 16 17 |
# File 'lib/roby/task_structure/planned_by.rb', line 15 def planned_task each_in_neighbour_merged(PlannedBy, intrusive: true).first end |