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.



600
601
602
603
604
605
606
607
608
609
610
611
# File 'lib/roby/event_structure/temporal_constraints.rb', line 600

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



570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
# File 'lib/roby/event_structure/temporal_constraints.rb', line 570

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