mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-25 08:36:08 +08:00
add parameter wrapper macros for ros
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user