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

Constructor Details

#initialize(plan) ⇒ Interface

Returns a new instance of Interface.



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

def initialize(plan)
    @plan = plan
end

Instance Attribute Details

#planObject (readonly)

The plan to which this action interface adds tasks



21
22
23
# File 'lib/roby/actions/interface.rb', line 21

def plan
  @plan
end

Instance Method Details

#action_script(task, &block) ⇒ Object



36
37
38
39
40
41
# File 'lib/roby/actions/interface.rb', line 36

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



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

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



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

def model; self.class end