Class: Roby::EventStructure::TemporalConstraints

Inherits:
Object
  • Object
show all
Defined in:
lib/roby/event_structure/temporal_constraints.rb

Defined Under Namespace

Modules: EventFiredHook, Extension

Instance Method Summary collapse

Instance Method Details

#check_structure(plan) ⇒ Object

Check the temporal constraint structure

What it needs to do is check that events that should have been emitted had been. The emission of events outside of allowed intervals is already taken care of.

Optimize by keeping the list of of maximum bounds at which an event should be emitted.



656
657
658
659
660
661
662
663
664
665
666
667
# File 'lib/roby/event_structure/temporal_constraints.rb', line 656

def check_structure(plan)
    deadlines = plan.emission_deadlines

    # Now look for the timeouts
    errors = []
    deadlines.missed_deadlines(Time.now)
        .each do |deadline, event, generator|
            errors << MissedDeadlineError.new(generator, event, deadline)
        end

    errors
end

#merge_info(parent, child, opt1, opt2) ⇒ Object

Returns the DisjointIntervalSet that represent the merge of the deadlines represented by opt1 and opt2



626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
# File 'lib/roby/event_structure/temporal_constraints.rb', line 626

def merge_info(parent, child, opt1, opt2)
    result = TemporalConstraintSet.new
    if opt1.intervals.size > opt2.intervals.size
        result.intervals.concat(opt1.intervals)
        for i in opt2.intervals
            result.add(*i)
        end
    else
        result.intervals.concat(opt2.intervals)
        for i in opt1.intervals
            result.add(*i)
        end
    end

    result.occurence_constraints.merge!(opt1.occurence_constraints)
    opt2.occurence_constraints.each do |recurrent, spec|
        result.add_occurence_constraint(spec[0], spec[1], recurrent)
    end

    result
end