add parameter wrapper macros for ros

This commit is contained in:
Thomas Gubler
2014-12-03 12:31:37 +01:00
parent 905913986a
commit 6a99b04fb7
2 changed files with 10 additions and 0 deletions
+8
View File
@@ -74,6 +74,14 @@ PX4_MAIN_FUNCTION(subscriber) {
*/
px4::NodeHandle n;
/* Define a parameter */
PX4_PARAM_INIT("SUB_INTERV", 100);
/* Read the parameter back for testing */
int32_t sub_interval;
PX4_PARAM_GET("SUB_INTERV", &sub_interval);
PX4_INFO("Param SUB_INTERV = %d", sub_interval);
/**
* The subscribe() call is how you tell ROS that you want to receive messages
* on a given topic. This invokes a call to the ROS
+2
View File
@@ -51,6 +51,8 @@
#define PX4_TOPIC_T(_name) _name
#define PX4_SUBSCRIBE_CBMETH(_nodehandle, _name, _cbf, _obj, _interval) _nodehandle.subscribe(PX4_TOPIC(_name), &_cbf, &_obj);
#define PX4_SUBSCRIBE_CBFUNC(_nodehandle, _name, _cbf, _interval) _nodehandle.subscribe(PX4_TOPIC(_name), _cbf);
#define PX4_PARAM_INIT(_name, _default) ros::param::set(_name, _default);
#define PX4_PARAM_GET(_name, _destpt) ros::param::get(_name, *_destpt)
#else
/*
* Building for NuttX