This is a simple helper-package for loading variables from the parameter server.
The main idea is to simplify the handling of parameters, which can be set to default values. The load() function will print if a parameter is loaded from the server or if its default value is used. In each case, the final value is printed, too.
rosrun parameter_pa parameter_pa_node roslaunch parameter_pa parameter_pa.launch
Services:
Service Name | Type | Description ------------------------|--------------------------------------------------------------------------------------------------------------------------------|--------------------------------- "~/substitutePath" | parameter_pa/ParameterPaString | Replaces each "$(find xyz)" with the corresponding path - this is similar to calling loadPath(). "~/substituteRessource" | parameter_pa/ParameterPaString | Resolves ressource name - this is similar to calling loadTopic().
The main load() function can handle bool, int, double and string - all as single values and as vectors. Also matrices of double (float) can be loaded.
Additionaly, there are two more dedicated load functions: loadPath() and loadTopic(). Both are basically loading a simple string from the parameter server as descript above. Furthermore the strings are specificly manipulated:
loadPath()
Every "$(find xyz)" will be replaced with the path of package xyz.
loadTopic()
Names are resolved with additional operators.
For these examples assume that ROS_NAMESPACE is set to "/name/space" and that the nodes' name is "parameter_pa_node"
Regular ressource names (no change): in_string | out_string | comment ---------------|----------------|-------- ressource | ressource | relative name ressource/ | ressource/ | relative name ending with slash ns/ressource | ns/ressource | relative name with namespace ns/ressource/ | ns/ressource/ | relative name with namespace ending with slash /ressource | /ressource | absolute name /ressource/ | /ressource/ | absolute name ending with slash /ns/ressource | /ns/ressource | absolute name with namespace /ns/ressource/ | /ns/ressource/ | absolute name with namespace ending with slash
Private ressource names (~/): in_string | out_string | comment ----------------|---------------------------------------------|-------- ~ | /name/space/parameter_pa_node | private namespace ~/ | /name/space/parameter_pa_node/ | private namespace ending with slash ~/ressource | /name/space/parameter_pa_node/ressource | private namespace with relative name ~/ns/ressource/ | /name/space/parameter_pa_node/ns/ressource/ | private namespace with relative name and relative namespace ending in slash /abc/~/xyz | Error | no private namespace within absolute name allowed
Locale ressource names (./): in_string | out_string | comment ----------------|---------------------------|-------- . | /name/space | local namespace ./ | /name/space/ | local namespace ending with slash ./ressource/ | /name/space/ressource/ | local namespace with relative name ending in slash ./ns/ressource | /name/space/ns/ressource | local namespace with relative name and relative namespace /abc/./xyz | /abc/xyz | local namespace within absolute name
Previous ressource names (../): in_string | out_string | comment ----------------|---------------------------|-------- .. | /name | previous namespace ../ | /name/ | previous namespace ending with slash ../ressource/ | /name/ressource/ | previous namespace with relative name ending in slash ../ns/ressource | /name/ns/ressource | previous namespace with relative name and relative namespace /abc/def/../xyz | /abc/xyz | previous namespace within absolute name
Removal of double slashes: in_string | out_string | comment ---------------|----------------|-------- ressource// | ressource/ | relative name ending with slash //ns/ressource | /ns/ressource | absolute name with namespace
More examples: in_string | out_string ----------------------------------|----------- ~/abc/.//def/../ns//ressource/ | /name/space/parameter_pa_node/abc/ns/ressource/ ns//.././..//ressource | /name/space/ressource ../../../../../../ressource/ | /ressource/
A typical output looks like this:
[ INFO] [1499357951.543886548]: load parameter ~/tf_lookup_time (0.1) [ INFO] [1499357951.544331412]: parameter ~/buffer_pointcloud not set (defaults to false) [ INFO] [1499357951.544867951]: load parameter ~/debugging (true)
Here is the related source code, which is taken from pcdfilter_pa:
cParameterPaRos paramloader; // ... paramloader.load("~/tf_lookup_time" , filters_.tf_lookup_time_ ); paramloader.load("~/buffer_pointcloud", rosparams_.buffer_pointcloud_); paramloader.load("~/debugging" , rosparams_.debugging_ );
Source code at github: + https://github.com/TUC-ProAut/ros_parameter
ROS packages: + ros-indigo-parameter-pa + ros-kinetic-parameter-pa + ros-lunar-parameter-pa
ROS-Distribution | Documentation --------------------|--------------- Indigo | docs.ros.org Jade (EOL May 2017) | docs.ros.org Kinetic | docs.ros.org Lunar | docs.ros.org