Package rosmaster :: Module paramserver :: Class ParamDictionary

Class ParamDictionary

source code

object --+
         |
        ParamDictionary

Instance Methods
 
__init__(self, reg_manager)
ctor.
source code
[int, str, [str]]
get_param_names(self)
Get list of all parameter names stored on this server.
source code
str
search_param(self, ns, key)
Search for matching parameter key for search param key.
source code
 
get_param(self, key)
Get the parameter in the parameter dictionary.
source code
 
set_param(self, key, value, notify_task=None)
Set the parameter in the parameter dictionary.
source code
 
subscribe_param(self, key, registration_args) source code
 
unsubscribe_param(self, key, unregistration_args)
Returns: return value of subscribers.unregister()
source code
 
delete_param(self, key, notify_task=None)
Delete the parameter in the parameter dictionary.
source code
bool
has_param(self, key)
Test for parameter existence
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, reg_manager)
(Constructor)

source code 

ctor.

Parameters:
  • subscribers (Registrations) - parameter subscribers
Overrides: object.__init__

get_param_names(self)

source code 

Get list of all parameter names stored on this server.

Returns: [int, str, [str]]
[code, statusMessage, parameterNameList]

search_param(self, ns, key)

source code 

Search for matching parameter key for search param key. Search for key starts at ns and proceeds upwards to the root. As such, search_param should only be called with a relative parameter name.

search_param's behavior is to search for the first partial match. For example, imagine that there are two 'robot_description' parameters:

  • /robot_description
  • /robot_description/arm
  • /robot_description/base
  • /pr2/robot_description
  • /pr2/robot_description/base

If I start in the namespace /pr2/foo and search for 'robot_description', search_param will match /pr2/robot_description. If I search for 'robot_description/arm' it will return /pr2/robot_description/arm, even though that parameter does not exist (yet).

Parameters:
  • ns (str) - namespace to begin search from.
  • key (str) - Parameter key.
Returns: str
key of matching parameter or None if no matching parameter.

get_param(self, key)

source code 

Get the parameter in the parameter dictionary.

Parameters:
  • key (str) - parameter key
Returns:
parameter value

set_param(self, key, value, notify_task=None)

source code 

Set the parameter in the parameter dictionary.

Parameters:
  • key (str) - parameter key
  • value - parameter value
  • notify_task (fn(updates)) - function to call with subscriber updates. updates is of the form [(subscribers, param_key, param_value)*]. The empty dictionary represents an unset parameter.

subscribe_param(self, key, registration_args)

source code 
Parameters:
  • key (str) - parameter key
  • registration_args (tuple) - additional args to pass to subscribers.register. First parameter is always the parameter key.

unsubscribe_param(self, key, unregistration_args)

source code 
Parameters:
  • key (str), str - parameter key
  • unregistration_args (tuple) - additional args to pass to subscribers.unregister. i.e. unregister will be called with (key, *unregistration_args)
Returns:
return value of subscribers.unregister()

delete_param(self, key, notify_task=None)

source code 

Delete the parameter in the parameter dictionary.

Parameters:
  • key, str - parameter key
  • notify_task, fn(updates) - function to call with subscriber updates. updates is of the form [(subscribers, param_key, param_value)*]. The empty dictionary represents an unset parameter.

has_param(self, key)

source code 

Test for parameter existence

Parameters:
  • key (str) - parameter key
Returns: bool
True if parameter set, False otherwise