Class: Orocos::InputPort
- Includes:
- InputPortBase
- Defined in:
- lib/orocos/input_port.rb,
lib/orocos/ros/ports.rb,
lib/orocos/async/orocos.rb,
ext/rorocos/rorocos.cc
Overview
This class represents output ports on remote task contexts.
They are obtained from TaskContext#port or TaskContext#each_port
Direct Known Subclasses
Constant Summary
Constants inherited from Port
Port::CONNECTION_POLICY_OPTIONS, Port::DEFAULT_CONNECTION_POLICY, Port::MQ_RTT_DEFAULT_QUEUE_LENGTH
Constants included from PortBase
PortBase::D_DIFFERENT_HOSTS, PortBase::D_SAME_HOST, PortBase::D_SAME_PROCESS, PortBase::D_UNKNOWN
Instance Attribute Summary
Attributes included from PortBase
#model, #name, #orocos_type_name, #task, #type
Class Method Summary collapse
-
.writer_class ⇒ Object
Used by InputPortWriteAccess to determine which class should be used to create the writer.
Instance Method Summary collapse
-
#initialize(task, name, orocos_type_name, model) ⇒ InputPort
constructor
A new instance of InputPort.
-
#pretty_print(pp) ⇒ Object
:nodoc:.
-
#subscribe_to_ros(topic_name = default_ros_topic_name, policy = Hash.new) ⇒ Object
Subscribes this port on a ROS topic.
- #to_async(options = Hash.new) ⇒ Object
- #to_proxy(options = Hash.new) ⇒ Object
-
#unsubscribe_from_ros(topic_name = "#{task.name}/#{self.name}") ⇒ Object
Subscribes this port from a ROS topic.
Methods included from InputPortBase
#connect_to, #resolve_connection_from, #resolve_disconnection_from, #write, #writer
Methods inherited from Port
#connected?, #create_stream, #default_ros_topic_name, #disconnect_all, #do_create_stream, #do_disconnect_all, #do_disconnect_from, #do_remove_stream, #doc, #doc?, #handle_mq_transport, prepare_policy, #refine_exceptions, #remove_stream, #to_orocos_port, transient_local_port_name, transport_name, #type_name, validate_policy
Methods included from PortBase
#==, #distance_to, #ensure_type_available, #full_name, #log_metadata, #max_marshalling_size, #max_sizes, #new_sample, #to_s
Constructor Details
#initialize(task, name, orocos_type_name, model) ⇒ InputPort
Returns a new instance of InputPort
14 15 16 17 |
# File 'lib/orocos/input_port.rb', line 14 def initialize(task, name, orocos_type_name, model) super @blocking_read = false end |
Class Method Details
.writer_class ⇒ Object
Used by InputPortWriteAccess to determine which class should be used to create the writer
21 22 23 |
# File 'lib/orocos/input_port.rb', line 21 def self.writer_class InputWriter end |
Instance Method Details
#pretty_print(pp) ⇒ Object
:nodoc:
25 26 27 28 |
# File 'lib/orocos/input_port.rb', line 25 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( = Hash.new) if use = .delete(:use) Orocos::Async::CORBA::InputPort.new(use,self,) else to_async(Hash[:use => task.to_async].merge()) end end |
#to_proxy(options = Hash.new) ⇒ Object
60 61 62 |
# File 'lib/orocos/async/orocos.rb', line 60 def to_proxy( = Hash.new) task.to_proxy().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 |