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.
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: load_path() and load_topic(). Both are basically loading a simple string from the parameter server as descript above. Furthermore the strings are specificly manipulated: + load_path(): Every "$(find xyz)" will be replaced with the path of package xyz. + load_topic(): Names are resolved relativ to current namespace or node. "~xyz" will resolve to "/ns/current_node/xyz" and "/xyz" will resolve to "/ns/xyz" (not in namespace of current node).
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/peterweissig/ros_parameter
ROS-Distribution | Documentation -----------------|--------------- Indigo | docs.ros.org Jade | docs.ros.org Kinetic | docs.ros.org Lunar | docs.ros.org