class Orocos::ROS::OutputTopic

Public Class Methods

reader_class() click to toggle source

Used by OutputPortReadAccess to determine which output reader class should be used

# File lib/orocos/ros/topic.rb, line 62
def self.reader_class; OutputReader end

Public Instance Methods

connect_to(sink, policy = Hash.new) click to toggle source

Subscribes an input to this topic

@param [#to_orocos_port] sink the sink port

Calls superclass method Orocos::OutputPortBase#connect_to
# 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) click to toggle source

Unsubscribes an input to this topic

@param [#to_orocos_port] sink the sink port

Calls superclass method Orocos::OutputPortBase#disconnect_from
# 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) click to toggle source
# File lib/orocos/ros/topic.rb, line 101
def to_async(options = Hash.new)
    if use = options.delete(:use)
        Orocos::Async::CORBA::OutputPort.new(use,self)
    else to_async(:use => task.to_async(options))
    end
end
to_proxy(options = Hash.new) click to toggle source
# File lib/orocos/ros/topic.rb, line 108
def to_proxy(options = Hash.new)
    task.to_proxy(options).port(name,:type => type)
end