Class: Orocos::ROS::InputTopic
- Includes:
- InputPortBase
- 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 collapse
-
#topic_name ⇒ Object
writeonly
The scheme we use for topic connection is to normalize the output topic names as /node/name and then remap the input topics.
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
-
.writer_class ⇒ Object
Used by InputPortWriteAccess to determine which class should be used to create the writer.
Instance Method Summary collapse
-
#resolve_connection_from(port, options = Hash.new) ⇒ Object
This method is part of the connection protocol.
-
#resolve_disconnection_from(port, options = Hash.new) ⇒ Object
This method is part of the connection protocol.
- #to_async(options = Hash.new) ⇒ Object
- #to_proxy(options = Hash.new) ⇒ Object
Methods included from InputPortBase
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
Instance Attribute Details
#topic_name=(value) ⇒ Object (writeonly)
The scheme we use for topic connection is to normalize the output topic names as /node/name and then remap the input topics.
This allows to overide the topic name on the input topics
120 121 122 |
# File 'lib/orocos/ros/topic.rb', line 120 def topic_name=(value) @topic_name = value end |
Class Method Details
.writer_class ⇒ Object
Used by InputPortWriteAccess to determine which class should be used to create the writer
124 125 126 |
# File 'lib/orocos/ros/topic.rb', line 124 def self.writer_class InputWriter end |
Instance Method Details
#resolve_connection_from(port, options = Hash.new) ⇒ Object
This method is part of the connection protocol
Whenever an output is connected to an input, if the receiver object cannot resolve the connection, it calls #resolve_connection_from on its target
149 150 151 152 153 154 155 156 157 |
# File 'lib/orocos/ros/topic.rb', line 149 def resolve_connection_from(port, = Hash.new) # Note that we are sure that +port+ is an output. We now 'just' # have to check what kind of output, and act accordingly if port.respond_to?(:publish_on_ros) port.publish_on_ros(topic_name, ) else raise ArgumentError, "I don't know how to connect #{port} to #{self}" end end |
#resolve_disconnection_from(port, options = Hash.new) ⇒ Object
This method is part of the connection protocol
Whenever an output is connected to an input, if the receiver object cannot resolve the connection, it calls #resolve_disconnection_from on its target
169 170 171 172 173 174 175 176 177 |
# File 'lib/orocos/ros/topic.rb', line 169 def resolve_disconnection_from(port, = Hash.new) # Note that we are sure that +port+ is an output. We now 'just' # have to check what kind of output, and act accordingly if port.respond_to?(:unpublish_from_ros) port.unpublish_from_ros(topic_name) else raise ArgumentError, "I don't know how to disconnect #{port} from #{self}" end end |
#to_async(options = Hash.new) ⇒ Object
128 129 130 131 132 133 |
# File 'lib/orocos/ros/topic.rb', line 128 def to_async( = Hash.new) if use = .delete(:use) Orocos::Async::CORBA::InputPort.new(use,self) else to_async(:use => task.to_async()) end end |
#to_proxy(options = Hash.new) ⇒ Object
135 136 137 |
# File 'lib/orocos/ros/topic.rb', line 135 def to_proxy( = Hash.new) task.to_proxy().port(name,:type => type) end |