aboutsummaryrefslogtreecommitdiff
path: root/src/platforms/px4_defines.h
diff options
context:
space:
mode:
authorThomas Gubler <thomasgubler@gmail.com>2014-12-11 15:04:37 +0100
committerThomas Gubler <thomasgubler@gmail.com>2014-12-11 15:04:37 +0100
commitc68c277c94cacd2a64b634dd9c45ace2a04c2911 (patch)
tree20e875d0a0f3c51c69b98f6a82aaefdedf8621bf /src/platforms/px4_defines.h
parentfd6a5fd38b194300788c597fd1636b2a97e24642 (diff)
downloadpx4-firmware-c68c277c94cacd2a64b634dd9c45ace2a04c2911.tar.gz
px4-firmware-c68c277c94cacd2a64b634dd9c45ace2a04c2911.tar.bz2
px4-firmware-c68c277c94cacd2a64b634dd9c45ace2a04c2911.zip
subscription class for ros now stores last message to avoid manual copy and support subscription with no callbacks
Diffstat (limited to 'src/platforms/px4_defines.h')
-rw-r--r--src/platforms/px4_defines.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/platforms/px4_defines.h b/src/platforms/px4_defines.h
index 819954d0e..fa3ef216a 100644
--- a/src/platforms/px4_defines.h
+++ b/src/platforms/px4_defines.h
@@ -70,7 +70,7 @@
/* Subscribe and providing a function as callback (do not use directly, use PX4_SUBSCRIBE instead) */
#define PX4_SUBSCRIBE_CBFUNC(_nodehandle, _name, _cbf, _interval) _nodehandle.subscribe(PX4_TOPIC(_name), _cbf);
/* Subscribe without a callback (do not use directly, use PX4_SUBSCRIBE instead) */
-#define PX4_SUBSCRIBE_NOCB(_nodehandle, _name, _interval) _nodehandle.subscribe<const PX4_TOPIC_T(_name)&>(PX4_TOPIC(_name));
+#define PX4_SUBSCRIBE_NOCB(_nodehandle, _name, _interval) _nodehandle.subscribe<PX4_TOPIC_T(_name)>(PX4_TOPIC(_name));
/* Parameter handle datatype */
typedef const char *px4_param_t;
@@ -93,6 +93,9 @@ static inline px4_param_t PX4_ROS_PARAM_SET(const char *name, float value)
/* Get value of parameter */
#define PX4_PARAM_GET(_handle, _destpt) ros::param::get(_handle, *_destpt)
+/* Get a subscriber class type based on the topic name */
+#define PX4_SUBSCRIBER_T(_name) SubscriberROS<PX4_TOPIC_T(_name)>
+
#else
/*
* Building for NuttX
@@ -130,6 +133,15 @@ typedef param_t px4_param_t;
/* Get value of parameter */
#define PX4_PARAM_GET(_handle, _destpt) param_get(_handle, _destpt)
+
+/* Get a subscriber class type based on the topic name */
+#define PX4_SUBSCRIBER_T(_name) SubscriberUORB<PX4_TOPIC_T(_name)>
+
+/* XXX this is a hack to resolve conflicts with NuttX headers */
+#define isspace(c) \
+ ((c) == ' ' || (c) == '\t' || (c) == '\n' || \
+ (c) == '\r' || (c) == '\f' || c== '\v')
+
#endif
/* Shortcut for subscribing to topics
@@ -146,7 +158,3 @@ typedef param_t px4_param_t;
/* wrapper for rotation matrices stored in arrays */
#define PX4_R(_array, _x, _y) PX4_ARRAY2D(_array, 3, _x, _y)
-
-#define isspace(c) \
- ((c) == ' ' || (c) == '\t' || (c) == '\n' || \
- (c) == '\r' || (c) == '\f' || c== '\v')