Class: Orocos::InputPort

Inherits:
Port
  • Object
show all
Includes:
InputPortBase
Defined in:
lib/orocos/ports.rb,
lib/orocos/ros/ports.rb,
lib/orocos/async/orocos.rb

Overview

This class represents output ports on remote task contexts.

They are obtained from TaskContext#port or TaskContext#each_port

Constant Summary

Constants inherited from Port

Port::CONNECTION_POLICY_OPTIONS, Port::DEFAULT_CONNECTION_POLICY

Instance Attribute Summary

Attributes included from PortBase

#model, #name, #orocos_type_name, #task, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods included from InputPortBase

#connect_to, #resolve_connection_from, #resolve_disconnection_from, #write, #writer

Methods inherited from Port

#create_stream, #default_ros_topic_name, #disconnect_all, #doc, #doc?, prepare_policy, #remove_stream, #to_orocos_port, transient_local_port_name, transport_name, #type_name, validate_policy

Methods included from PortBase

#==, #ensure_type_available, #full_name, #initialize, #log_metadata, #max_marshalling_size, #max_sizes, #new_sample, #to_s

Class Method Details

.writer_classObject

Used by InputPortWriteAccess to determine which class should be used to create the writer


249
250
251
# File 'lib/orocos/ports.rb', line 249

def self.writer_class
    InputWriter
end

Instance Method Details

#pretty_print(pp) ⇒ Object

:nodoc:


253
254
255
256
# File 'lib/orocos/ports.rb', line 253

def pretty_print(pp) # :nodoc:
    pp.text "in "
    super
end

#subscribe_to_ros(topic_name = default_ros_topic_name, policy = Hash.new) ⇒ Object

Subscribes this port on a ROS topic


25
26
27
28
29
30
# File 'lib/orocos/ros/ports.rb', line 25

def subscribe_to_ros(topic_name = default_ros_topic_name, policy = Hash.new)
    if topic_name.kind_of?(Hash)
        topic_name, policy = default_ros_topic_name, topic_name
    end
    create_stream(Orocos::TRANSPORT_ROS, topic_name, policy)
end

#to_async(options = Hash.new) ⇒ Object


53
54
55
56
57
58
# File 'lib/orocos/async/orocos.rb', line 53

def to_async(options = Hash.new)
    if use = options.delete(:use)
        Orocos::Async::CORBA::InputPort.new(use,self,options)
    else to_async(Hash[:use => task.to_async].merge(options))
    end
end

#to_proxy(options = Hash.new) ⇒ Object


60
61
62
# File 'lib/orocos/async/orocos.rb', line 60

def to_proxy(options = Hash.new)
    task.to_proxy(options).port(name,:type => type)
end

#unsubscribe_from_ros(topic_name = "#{task.name}/#{self.name}") ⇒ Object

Subscribes this port from a ROS topic


33
34
35
# File 'lib/orocos/ros/ports.rb', line 33

def unsubscribe_from_ros(topic_name = "#{task.name}/#{self.name}")
    remove_stream(topic_name)
end