Module: Roby::TaskStructure::Conflicts::EventGeneratorExtension

Defined in:
lib/roby/task_structure/conflicts.rb

Instance Method Summary collapse

Instance Method Details

#calling(context) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/roby/task_structure/conflicts.rb', line 33

def calling(context)
    super
    return unless symbol == :start

    # Check for conflicting tasks
    result = Set.new
    task.each_conflicts do |conflicting_task|
        result << conflicting_task
    end

    models = task.class.conflicting_models
    for model in models
        for t in plan.find_tasks(model)
            if t.running? && t != task
                result << t
            end
        end
    end

    unless result.empty?
        plan.control.conflict(task, result)
        return
    end

    # Add the needed conflict relations
    models = task.class.conflicting_models
    for model in models
        for t in plan.find_tasks(model)
            t.conflicts_with task if t.pending? && t != task
        end
    end
end

#fired(event) ⇒ Object



66
67
68
69
70
71
72
# File 'lib/roby/task_structure/conflicts.rb', line 66

def fired(event)
    super

    if symbol == :stop
        task.relation_graph_for(Conflicts).remove_vertex(task)
    end
end