Class: OroGen::Spec::InputPort

Inherits:
Port
  • Object
show all
Defined in:
lib/orogen/spec/input_port.rb

Overview

Specification for an input port

Direct Known Subclasses

ROS::Spec::InputTopic, DynamicInputPort

Instance Attribute Summary collapse

Attributes inherited from Port

#name, #task, #type

Instance Method Summary collapse

Methods inherited from Port

compute_max_marshalling_size, #dynamic, #dynamic?, #each_interface_type, initialize_max_size_sample, #max_marshalling_size, #max_sizes, #orocos_type_name, #pretty_print, resolve_max_size_path, #static, #static?, #to_h, #type_name, validate_max_sizes_spec

Constructor Details

#initialize(*args) ⇒ InputPort


7
8
9
10
# File 'lib/orogen/spec/input_port.rb', line 7

def initialize(*args)
    super
    @required_connection_type = :data
end

Instance Attribute Details

#required_connection_typeObject (readonly)

Returns the value of attribute required_connection_type


5
6
7
# File 'lib/orogen/spec/input_port.rb', line 5

def required_connection_type
  @required_connection_type
end

Instance Method Details

#do_not_cleanObject

In oroGen, input ports are cleared in the startHook()

Calling #do_not_clean disables this behaviour for this particular port


70
71
72
# File 'lib/orogen/spec/input_port.rb', line 70

def do_not_clean
    @do_not_clean = true
end

#multiplexesObject

Declares that this port accepts multiple active connections


80
81
82
83
# File 'lib/orogen/spec/input_port.rb', line 80

def multiplexes
    @multiplexes = true
    self
end

#multiplexes?Boolean

If true, this port accepts to have multiple active connections at the same time


75
76
77
# File 'lib/orogen/spec/input_port.rb', line 75

def multiplexes?
    !!@multiplexes
end

#needs_buffered_connectionObject

True if connections to this port must use a buffered. In general, it means that the task's code check the return value of read(), as in

if (_input.read(value))
{
    // data is available, do something
}

45
# File 'lib/orogen/spec/input_port.rb', line 45

def needs_buffered_connection; @required_connection_type = :buffer; self end

#needs_data_connectionObject

True if connections to this port must use a data policy.

This should not be useful in general


50
# File 'lib/orogen/spec/input_port.rb', line 50

def needs_data_connection; @required_connection_type = :data; self end

#needs_reliable_connectionObject

Declares that the task context requires a non-lossy policy

This is different from #requires_buffered_connection as a data policy could be used if the period of the connection's source is much longer than the period of the connection's end (for instance).


64
# File 'lib/orogen/spec/input_port.rb', line 64

def needs_reliable_connection; @needs_reliable_connection = true; self end

#needs_reliable_connection?Boolean

Returns true if the task context requires connections to this port to be reliable (i.e. non-lossy).

See #needs_reliable_policy for more information


56
# File 'lib/orogen/spec/input_port.rb', line 56

def needs_reliable_connection?; @needs_reliable_connection end

#task_triggerObject

If called, this port will be registered on the task as a trigger port,

i.e. the following

task_context "Name" do
  input_port("port", "int").
    trigger_port
end

is equivalent to

task_context "Name" do
  input_port("port", "int")
  port_driven 'port'
end

The difference with port_driven is that it works on dynamic ports as well


33
34
35
# File 'lib/orogen/spec/input_port.rb', line 33

def task_trigger
    task.port_driven(name)
end