Class: Roby::Actions::Interface

Inherits:
Object
  • Object
show all
Extended by:
Logger::Hierarchy, Models::Interface, DRoby::Identifiable, DRoby::V5::ModelDumper
Defined in:
lib/roby/actions/interface.rb,
lib/roby/droby/enable.rb

Overview

Functionality to gather information about the actions available on a given Roby app

Actions are simply methods of arity zero or one, preceded by a call to #describe. The methods can modify the current plan (available as #plan) and must return the Roby::Task instance that will be used to represent the action during execution

class Iface < Roby::Actions::Interface
    describe "makes the robot turn"
    def robot_turn
    end
end

Direct Known Subclasses

Coordination::FaultResponseTable

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DRoby::Identifiable

droby_id, initialize_copy

Methods included from DRoby::V5::ModelDumper

droby_dump, droby_marshallable?

Constructor Details

#initialize(plan) ⇒ Interface

Returns a new instance of Interface.



25
26
27
# File 'lib/roby/actions/interface.rb', line 25

def initialize(plan)
    @plan = plan
end

Instance Attribute Details

#planObject (readonly)

The plan to which this action interface adds tasks



23
24
25
# File 'lib/roby/actions/interface.rb', line 23

def plan
  @plan
end

Instance Method Details

#action_script(task, &block) ⇒ Object



40
41
42
43
44
45
# File 'lib/roby/actions/interface.rb', line 40

def action_script(task, &block)
    model = Coordination::ActionScript
        .new_submodel(action_interface: self.model, root: task.model)
    model.parse(&block)
    model.new(task)
end

#action_state_machine(task, &block) ⇒ Object



33
34
35
36
37
38
# File 'lib/roby/actions/interface.rb', line 33

def action_state_machine(task, &block)
    model = Coordination::ActionStateMachine
        .new_submodel(action_interface: self.model, root: task.model)
    model.parse(&block)
    model.new(task)
end

#modelObject



29
30
31
# File 'lib/roby/actions/interface.rb', line 29

def model
    self.class
end