Class: ROS::Topic

Inherits:
Object
  • Object
show all
Defined in:
lib/ros/topic.rb

Overview

Base class of Publisher and Subscriber

Direct Known Subclasses

Publisher, Subscriber

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(caller_id, topic_name, topic_type) ⇒ Topic

initialize member variables

Parameters:

  • caller_id (String)

    caller id of this node

  • topic_name (String)

    name of this topic

  • topic_type (Class)

    class of msg



19
20
21
22
23
24
25
# File 'lib/ros/topic.rb', line 19

def initialize(caller_id, topic_name, topic_type)
  @caller_id = caller_id
  @topic_name = topic_name
  @topic_type = topic_type
  @connections = []
  @connection_id_number = 0
end

Instance Attribute Details

#caller_idString (readonly)

Returns caller id.

Returns:

  • (String)

    caller id



28
29
30
# File 'lib/ros/topic.rb', line 28

def caller_id
  @caller_id
end

#topic_nameString (readonly)

Returns name of this topic.

Returns:

  • (String)

    name of this topic



31
32
33
# File 'lib/ros/topic.rb', line 31

def topic_name
  @topic_name
end

#topic_typeClass (readonly)

Returns class of msg.

Returns:

  • (Class)

    class of msg



34
35
36
# File 'lib/ros/topic.rb', line 34

def topic_type
  @topic_type
end

Instance Method Details

#closeObject

shutdown all connections



37
38
39
# File 'lib/ros/topic.rb', line 37

def close #:nodoc:
  @connections.each {|connection| connection.shutdown}
end

#set_manager(manager) ⇒ Object

set manager for shutdown

Parameters:



43
44
45
# File 'lib/ros/topic.rb', line 43

def set_manager(manager) #:nodoc:
  @manager = manager
end