Module rosparam

Module rosparam

source code

Implementation of the rosparam as well as a library for modifying the state of the ROS Parameter Server using YAML files.

Classes
  ROSParamException
rosparam base exception type
  ROSParamIOException
Exception for communication-based (i/o) errors.
Functions
 
represent_xml_binary(loader, data)
Adds a pyyaml serializer to handle xmlrpclib.Binary objects
source code
 
construct_yaml_binary(loader, node)
Overrides pyaml's constructor for binary data.
source code
 
construct_angle_radians(loader, node)
python-yaml utility for converting rad(num) into float value
source code
 
construct_angle_degrees(loader, node)
python-yaml utility for converting deg(num) into float value
source code
 
print_params(params, ns)
Print contents of param dictionary to screen
source code
 
load_file(filename, default_namespace=None, verbose=False)
Load the YAML document from the specified file
source code
[(dict, str)...]
load_str(str, filename, default_namespace=None, verbose=False)
Load the YAML document as a string
source code
 
get_param(param)
Download a parameter from Parameter Server
source code
 
dump_params(filename, param, verbose=False)
Download a parameter tree from the Parameter Server and store in a yaml file
source code
 
delete_param(param, verbose=False)
Delete a parameter from the Parameter Server
source code
 
set_param_raw(param, value, verbose=False)
Set param on the Parameter Server.
source code
 
set_param(param, value, verbose=False)
Set param on the ROS parameter server using a YAML value.
source code
 
upload_params(ns, values, verbose=False)
Upload params to the Parameter Server
source code
 
list_params(ns)
Get list of parameters in ns
source code
 
yamlmain(argv=None)
Command-line main routine.
source code
Variables
  NAME = 'rosparam'
  NS = '_ns'
  pattern = re.compile(r'^rad\([^\)]*\)$')
  __package__ = None
Function Details

construct_yaml_binary(loader, node)

source code 

Overrides pyaml's constructor for binary data. Wraps binary data in xmlrpclib.Binary container instead of straight string representation.

load_file(filename, default_namespace=None, verbose=False)

source code 

Load the YAML document from the specified file

Parameters:
  • filename (str) - name of filename
  • default_namespace (str) - namespace to load filename into
Raises:

load_str(str, filename, default_namespace=None, verbose=False)

source code 

Load the YAML document as a string

Parameters:
  • filename (str) - name of filename, only used for debugging
  • default_namespace (str) - namespace to load filename into
  • str (str) - YAML text
Returns: [(dict, str)...]
list of parameter dictionary and corresponding namespaces for each YAML document in the file

get_param(param)

source code 

Download a parameter from Parameter Server

Parameters:
  • param (str) - parameter name to retrieve from parameter server. If param is a parameter namespace, entire parameter subtree will be downloaded.

dump_params(filename, param, verbose=False)

source code 

Download a parameter tree from the Parameter Server and store in a yaml file

Parameters:
  • filename (str) - name of file to save YAML representation
  • param (str) - name of parameter/namespace to dump
  • verbose (bool) - print verbose output for debugging

delete_param(param, verbose=False)

source code 

Delete a parameter from the Parameter Server

Parameters:
  • param (str) - parameter name
  • verbose (bool) - print verbose output for debugging

set_param_raw(param, value, verbose=False)

source code 

Set param on the Parameter Server. Unlike set_param(), this takes in a Python value to set instead of YAML.

Parameters:
  • param (str) - parameter name
  • value (XmlRpcLegalValue), XmlRpcLegalValue - value to upload

set_param(param, value, verbose=False)

source code 

Set param on the ROS parameter server using a YAML value.

Parameters:
  • param (str) - parameter name
  • value (str) - yaml-encoded value

upload_params(ns, values, verbose=False)

source code 

Upload params to the Parameter Server

Parameters:
  • values (dict) - key/value dictionary, where keys are parameter names and values are parameter values
  • ns (str) - namespace to load parameters into

list_params(ns)

source code 

Get list of parameters in ns

Parameters:
  • ns (str) - namespace to match

yamlmain(argv=None)

source code 

Command-line main routine. Loads in one or more input files

Parameters:
  • argv ([str]) - command-line arguments or None to use sys.argv