Class: Roby::Coordination::Script::TimeoutStart
- Inherits:
-
Roby::Coordination::ScriptInstruction
- Object
- Roby::Coordination::ScriptInstruction
- Roby::Coordination::Script::TimeoutStart
- Defined in:
- lib/roby/coordination/script.rb
Instance Attribute Summary collapse
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#timeout_stop ⇒ Object
Returns the value of attribute timeout_stop.
Instance Method Summary collapse
- #execute(script) ⇒ Object
-
#initialize(model, event) ⇒ TimeoutStart
constructor
A new instance of TimeoutStart.
Methods inherited from Roby::Coordination::ScriptInstruction
Constructor Details
#initialize(model, event) ⇒ TimeoutStart
Returns a new instance of TimeoutStart.
109 110 111 112 113 114 |
# File 'lib/roby/coordination/script.rb', line 109 def initialize(model, event) super() @model = model @event = event end |
Instance Attribute Details
#event ⇒ Object (readonly)
Returns the value of attribute event.
106 107 108 |
# File 'lib/roby/coordination/script.rb', line 106 def event @event end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
106 107 108 |
# File 'lib/roby/coordination/script.rb', line 106 def model @model end |
#timeout_stop ⇒ Object
Returns the value of attribute timeout_stop.
107 108 109 |
# File 'lib/roby/coordination/script.rb', line 107 def timeout_stop @timeout_stop end |
Instance Method Details
#execute(script) ⇒ Object
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/roby/coordination/script.rb', line 116 def execute(script) script.root_task.execution_engine.delayed(model.seconds) do unless disabled? # Remove all instructions that are within the # timeout's scope if event event.resolve.emit script.jump_to(timeout_stop) else e = TimedOut.new( script.root_task, script.current_instruction ) e = e.exception("#{script.current_instruction} timed out") script.root_task.execution_engine.add_error(e) end end end true end |