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

- (Topic) initialize(caller_id, topic_name, topic_type)

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

- (String) caller_id (readonly)

Returns caller id

Returns:

  • (String)

    caller id



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

def caller_id
  @caller_id
end

- (String) topic_name (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

- (Class) topic_type (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

- (Object) close

shutdown all connections



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

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

- (Object) set_manager(manager)

set manager for shutdown

Parameters:



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

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