diff --git a/src/platforms/px4_nodehandle.h b/src/platforms/px4_nodehandle.h index bfda636b0f..d668844453 100644 --- a/src/platforms/px4_nodehandle.h +++ b/src/platforms/px4_nodehandle.h @@ -37,12 +37,19 @@ * PX4 Middleware Wrapper Node Handle */ #pragma once + +/* includes for all platforms */ #include #include + #if defined(__linux) || (defined(__APPLE__) && defined(__MACH__)) +/* includes when building for ros */ #include "ros/ros.h" #include -#define QUEUE_SIZE_DEFAULT 1000 +#include +#else +/* includes when building for NuttX */ + #endif namespace px4 @@ -59,7 +66,7 @@ public: template Subscriber subscribe(const char *topic, void(*fp)(M)) { - ros::Subscriber ros_sub = ros::NodeHandle::subscribe(topic, QUEUE_SIZE_DEFAULT, fp); + ros::Subscriber ros_sub = ros::NodeHandle::subscribe(topic, kQueueSizeDefault, fp); Subscriber sub(ros_sub); _subs.push_back(sub); return sub; @@ -67,12 +74,13 @@ public: template Publisher advertise(const char *topic) { - ros::Publisher ros_pub = ros::NodeHandle::advertise(topic, QUEUE_SIZE_DEFAULT); + ros::Publisher ros_pub = ros::NodeHandle::advertise(topic, kQueueSizeDefault); Publisher pub(ros_pub); _pubs.push_back(pub); return pub; } private: + static const uint32_t kQueueSizeDefault = 1000; std::list _subs; std::list _pubs; }; diff --git a/src/platforms/px4_publisher.h b/src/platforms/px4_publisher.h index 7995251902..72f69a5af3 100644 --- a/src/platforms/px4_publisher.h +++ b/src/platforms/px4_publisher.h @@ -46,14 +46,14 @@ namespace px4 #if defined(__linux) || (defined(__APPLE__) && defined(__MACH__)) class Publisher { -private: - ros::Publisher _ros_pub; public: Publisher(ros::Publisher ros_pub) : _ros_pub(ros_pub) {} ~Publisher() {}; template int publish(const M &msg) { _ros_pub.publish(msg); return 0; } +private: + ros::Publisher _ros_pub; }; #else class Publisher diff --git a/src/platforms/px4_subscriber.h b/src/platforms/px4_subscriber.h index 8933b2ab22..78be3ebff6 100644 --- a/src/platforms/px4_subscriber.h +++ b/src/platforms/px4_subscriber.h @@ -47,12 +47,12 @@ namespace px4 #if defined(__linux) || (defined(__APPLE__) && defined(__MACH__)) class Subscriber { -private: - ros::Subscriber _ros_sub; public: Subscriber(ros::Subscriber ros_sub) : _ros_sub(ros_sub) {} ~Subscriber() {}; +private: + ros::Subscriber _ros_sub; }; #else class Subscriber