Class: ROS::ParameterSubscriber

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

Overview

callback object for paramUpdate

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, callback) ⇒ ParameterSubscriber

do not make instance directory. Plese use Node#subscribe_parameter.

Parameters:

  • key (String)

    param key to subscribe

  • callback (Proc)

    callback when parameter updated



21
22
23
24
# File 'lib/ros/parameter_subscriber.rb', line 21

def initialize(key, callback)
  @key = key
  @callback = callback
end

Instance Attribute Details

#keyObject

key of parameter for subscription



44
45
46
# File 'lib/ros/parameter_subscriber.rb', line 44

def key
  @key
end

Instance Method Details

#call(value) ⇒ Object

callback with param value

Parameters:

  • value (String)

    value of updated parameter



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

def call(value)
  @callback.call(value)
end

#set_manager(manager) ⇒ Object

set GraphManager for management

Parameters:



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

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

#shutdownObject

shutdown this subscription



39
40
41
# File 'lib/ros/parameter_subscriber.rb', line 39

def shutdown
  @manager.shutdown_parameter_subscriber(self)
end