Class: Orocos::ROS::OutputTopic
- Includes:
- OutputPortBase
- Defined in:
- lib/orocos/ros/topic.rb
Constant Summary
Constants included from PortBase
PortBase::D_DIFFERENT_HOSTS, PortBase::D_SAME_HOST, PortBase::D_SAME_PROCESS, PortBase::D_UNKNOWN
Instance Attribute Summary
Attributes inherited from Topic
#doc, #ros_message_type, #topic_name
Attributes included from PortBase
#model, #name, #orocos_type_name, #task, #type
Class Method Summary collapse
-
.reader_class ⇒ Object
Used by OutputPortReadAccess to determine which output reader class should be used.
Instance Method Summary collapse
-
#connect_to(sink, policy = Hash.new) ⇒ Object
Subscribes an input to this topic.
-
#disconnect_from(sink) ⇒ Object
Unsubscribes an input to this topic.
- #to_async(options = Hash.new) ⇒ Object
- #to_proxy(options = Hash.new) ⇒ Object
Methods included from OutputPortBase
Methods inherited from Topic
#==, default_port_name, #doc?, #initialize, #pretty_print, transient_local_port_name
Methods included from PortBase
#==, #distance_to, #ensure_type_available, #full_name, #initialize, #log_metadata, #max_marshalling_size, #max_sizes, #new_sample, #to_s
Constructor Details
This class inherits a constructor from Orocos::ROS::Topic
Class Method Details
.reader_class ⇒ Object
Used by OutputPortReadAccess to determine which output reader class should be used
62 |
# File 'lib/orocos/ros/topic.rb', line 62 def self.reader_class; OutputReader end |
Instance Method Details
#connect_to(sink, policy = Hash.new) ⇒ Object
Subscribes an input to this topic
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/orocos/ros/topic.rb', line 67 def connect_to(sink, policy = Hash.new) ROS.debug "connect output topic #{self} to #{sink} with policy: #{policy}" if sink.respond_to?(:to_topic) sink = sink.to_topic if self.task.running? || sink.task.running? raise ArgumentError, "cannot use #connect_to on topics from running nodes" end sink.topic_name = self.topic_name elsif sink.respond_to?(:to_orocos_port) sink.to_orocos_port.subscribe_to_ros(topic_name, policy) else return super end end |
#disconnect_from(sink) ⇒ Object
Unsubscribes an input to this topic
86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/orocos/ros/topic.rb', line 86 def disconnect_from(sink) if sink.respond_to?(:to_topic) sink = sink.to_topic if self.task.running? || sink.task.running? raise ArgumentError, "cannot use #disconnect_from topics from running nodes" end sink.topic_name = "#{sink.task.name}/#{sink.name}" elsif sink.respond_to?(:to_orocos_port) sink.to_orocos_port.unsubscribe_from_ros(topic_name) else return super end end |
#to_async(options = Hash.new) ⇒ Object
101 102 103 104 105 106 |
# File 'lib/orocos/ros/topic.rb', line 101 def to_async( = Hash.new) if use = .delete(:use) Orocos::Async::CORBA::OutputPort.new(use,self) else to_async(:use => task.to_async()) end end |
#to_proxy(options = Hash.new) ⇒ Object
108 109 110 |
# File 'lib/orocos/ros/topic.rb', line 108 def to_proxy( = Hash.new) task.to_proxy().port(name,:type => type) end |