From 7ad3b0335336d65736f707486b2b714d0fa91c2a Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Wed, 17 Dec 2014 15:49:03 +0100 Subject: [PATCH] multi platform interface: macro to get param by name --- src/platforms/px4_defines.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/platforms/px4_defines.h b/src/platforms/px4_defines.h index c76548381b..1881490088 100644 --- a/src/platforms/px4_defines.h +++ b/src/platforms/px4_defines.h @@ -93,9 +93,12 @@ static inline px4_param_t PX4_ROS_PARAM_SET(const char *name, float value) /* Initialize a param, in case of ROS the parameter is sent to the parameter server here */ #define PX4_PARAM_INIT(_name) PX4_ROS_PARAM_SET(#_name, PX4_PARAM_DEFAULT_VALUE_NAME(_name)) -/* Get value of parameter */ +/* Get value of parameter by handle */ #define PX4_PARAM_GET(_handle, _destpt) ros::param::get(_handle, *_destpt) +/* Get value of parameter by name, which is equal to the handle for ros */ +#define PX4_PARAM_GET_NAME(_name, _destpt) PX4_PARAM_GET(_name, _destpt) + #define OK 0 #define ERROR -1 @@ -163,9 +166,12 @@ typedef param_t px4_param_t; /* Initialize a param, get param handle */ #define PX4_PARAM_INIT(_name) param_find(#_name) -/* Get value of parameter */ +/* Get value of parameter by handle */ #define PX4_PARAM_GET(_handle, _destpt) param_get(_handle, _destpt) +/* Get value of parameter by name */ +#define PX4_PARAM_GET_NAME(_name, _destpt) param_get(PX4_PARAM_INIT(_name), _destpt) + /* XXX this is a hack to resolve conflicts with NuttX headers */ #define isspace(c) \ ((c) == ' ' || (c) == '\t' || (c) == '\n' || \