class OroGen::ROS::Spec::XML::NodeDescription

This class represents the node description which can be extracted from a launch file

Attributes

name[R]
package[R]
type[R]

Public Class Methods

from_xml_node(node) click to toggle source

Create a node description from a xml node @return [OroGen::ROS::Spec::XML::NodeDescription] Node description object

# File lib/orogen/ros/spec/launcher.rb, line 42
def self.from_xml_node(node)
    name = node.attributes["name"].to_s
    package = node.attributes["pkg"].to_s
    type = node.attributes["type"].to_s

    nd = NodeDescription.new(name, package, type)

    NodeDescription.optional_attr.each do |o,_|
        if attr = node.attributes[o.to_s]
            nd.instance_variable_set("@#{o}",attr)
        end
    end
    nd
end
new(name, package, type) click to toggle source

Initialize the node description @argument name Name of the node @argument package Package name of the node @argument type ROS node type of this node

# File lib/orogen/ros/spec/launcher.rb, line 30
def initialize(name, package, type)
    @name = name
    @package = package
    @type = type

    NodeDescription.optional_attr.each do |op, val|
        self.instance_variable_set "@#{op}", val
    end
end
optional_attr() click to toggle source

Optional attributes in the ROS launcher specification @return [Hash] Hash of optional attributed along with the default value

# File lib/orogen/ros/spec/launcher.rb, line 22
def self.optional_attr
    @optional_attr
end

Public Instance Methods

to_s() click to toggle source

String description of this object @return [String]

# File lib/orogen/ros/spec/launcher.rb, line 59
def to_s
    desc = "NodeDescription: name: #{name}, package: #{package}, type: #{type}"
    NodeDescription.optional_attr.each do |o,_|
        val = instance_variable_get("@#{o}")
        desc += ", #{o}: #{val}"
    end
    desc
end