class OroGen::ROS::Spec::Node
Representation of a ROS node as an oroGen model
Attributes
ros_name[RW]
@return [String] the name on the ROS side
ros_package[RW]
@return [String] the name of the ROS package
Public Class Methods
new(project, name = nil)
click to toggle source
Calls superclass method
OroGen::Spec::TaskContext.new
# File lib/orogen/ros/spec/node.rb, line 11 def initialize(project, name = nil) super @ros_name = name @ros_package = project.name end
Public Instance Methods
==(other)
click to toggle source
Equals operator @return [Boolean] True, if ros node and package name equal equal, False otherwise
# File lib/orogen/ros/spec/node.rb, line 54 def ==(other) if other.respond_to?(:ros_name) if ros_name.empty? || other.ros_name.empty? raise ArgumentError, "Cannot compare ROS Spec node with empty ros_name: #{self} vs. #{other}" end return ros_name == other.ros_name && ros_package == other.ros_package end false end
eql?(other)
click to toggle source
# File lib/orogen/ros/spec/node.rb, line 64 def eql?(other); self == other end
input_topic(topic_name, name, message_type)
click to toggle source
Declares that this node subscribes to a specific topic
@param [String] topic_name the topic name @param [String] name the name on which this topic should be
registered on self
@param [String] message_type the name of the ROS message type. A
ROS mapping must exist for it
@return [InputTopic]
# File lib/orogen/ros/spec/node.rb, line 41 def input_topic(topic_name, name, message_type) data_type = project.ros_loader.map_message_type_to_orogen(message_type) topic = input_port(name, data_type, :class => InputTopic) topic.ros_name = ROS.normalize_topic_name(topic_name) topic end
output_topic(topic_name, name, message_type)
click to toggle source
Declares that this node produces data on a specific topic
@param [String] topic_name the topic name @param [String] name the name on which this topic should be
registered on self
@param [String] message_type the name of the ROS message type. A
ROS mapping must exist for it
@return [OutputTopic]
# File lib/orogen/ros/spec/node.rb, line 26 def output_topic(topic_name, name, message_type) data_type = project.ros_loader.map_message_type_to_orogen(message_type) topic = output_port(name, data_type, :class => OutputTopic) topic.ros_name = ROS.normalize_topic_name(topic_name) topic end
to_s()
click to toggle source
# File lib/orogen/ros/spec/node.rb, line 48 def to_s "#{self.class} ros_name: #{ros_name}, ros_package: #{ros_package}" end