class Orocos::ROS::Topic

A Port-compatible implementation of a ROS topic. To map topics to ports, a Node will announce all the topics it is subscribed / it publishes as its own ports

Attributes

doc[R]

Documentation string

ros_message_type[R]

The ROS message type name

topic_name[R]

The topic name

Public Class Methods

default_port_name(topic_name) click to toggle source

@return [String] the default port name generated from a topic name

# File lib/orocos/ros/topic.rb, line 24
def self.default_port_name(topic_name)
    topic_name.gsub(/^~?\//, '')
end
new(task, topic_name, ros_message_type, model = nil, name = Topic.default_port_name(topic_name), orocos_type_name = nil) click to toggle source
Calls superclass method Orocos::PortBase.new
# File lib/orocos/ros/topic.rb, line 28
def initialize(task, topic_name, ros_message_type, model = nil,
               name = Topic.default_port_name(topic_name),
               orocos_type_name = nil)

    if !orocos_type_name
        candidates = ROS.find_all_types_for(ros_message_type)
        if candidates.empty?
            raise ArgumentError, "ROS message type #{ros_message_type} has no corresponding type on the oroGen side"
        end
        orocos_type_name = candidates.first
    end

    @ros_message_type = ros_message_type
    @topic_name = topic_name

    super(task, name, orocos_type_name, model)
end
transient_local_port_name(topic_name) click to toggle source
# File lib/orocos/ros/topic.rb, line 19
def self.transient_local_port_name(topic_name)
    "rostopics#{topic_name.gsub('/', '.')}.#{@@local_transient_port_id += 1}"
end

Public Instance Methods

==(other) click to toggle source
# File lib/orocos/ros/topic.rb, line 50
def ==(other)
    other.class == self.class &&
        other.topic_name == self.topic_name &&
        other.task == self.task
end
doc?() click to toggle source
# File lib/orocos/ros/topic.rb, line 16
def doc?; false end