aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Gubler <thomasgubler@gmail.com>2015-01-23 08:03:26 +0100
committerThomas Gubler <thomasgubler@gmail.com>2015-01-23 08:12:46 +0100
commit16c85c6d1870f6f410cf75fc0fe3cb386eb9f6ee (patch)
tree88b175f99a908194eca02079a8e55279e4904a4b /src
parent59f05a7195ae4a2d57e276c31e12bcf6af477408 (diff)
downloadpx4-firmware-16c85c6d1870f6f410cf75fc0fe3cb386eb9f6ee.tar.gz
px4-firmware-16c85c6d1870f6f410cf75fc0fe3cb386eb9f6ee.tar.bz2
px4-firmware-16c85c6d1870f6f410cf75fc0fe3cb386eb9f6ee.zip
move uorb::publisherbase into constructor of publisher
Diffstat (limited to 'src')
-rw-r--r--src/platforms/px4_nodehandle.h7
-rw-r--r--src/platforms/px4_publisher.h4
-rw-r--r--src/platforms/px4_subscriber.h7
3 files changed, 7 insertions, 11 deletions
diff --git a/src/platforms/px4_nodehandle.h b/src/platforms/px4_nodehandle.h
index c85b8118b..fd1647051 100644
--- a/src/platforms/px4_nodehandle.h
+++ b/src/platforms/px4_nodehandle.h
@@ -243,13 +243,8 @@ public:
template<typename T>
Publisher<T> *advertise()
{
- //XXX
- // uORB::PublicationBase * uorb_pub = new uORB::PublicationBase((new T())->handle());
- uORB::PublicationBase * uorb_pub = new uORB::PublicationBase(T::handle());
- PublisherUORB<T> *pub = new PublisherUORB<T>(uorb_pub);
-
+ PublisherUORB<T> *pub = new PublisherUORB<T>();
_pubs.add(pub);
-
return (Publisher<T>*)pub;
}
diff --git a/src/platforms/px4_publisher.h b/src/platforms/px4_publisher.h
index ea675e67b..a9e40e8d6 100644
--- a/src/platforms/px4_publisher.h
+++ b/src/platforms/px4_publisher.h
@@ -130,10 +130,10 @@ public:
/**
* Construct Publisher by providing orb meta data
*/
- PublisherUORB(uORB::PublicationBase * uorb_pub) :
+ PublisherUORB() :
Publisher<T>(),
PublisherNode(),
- _uorb_pub(uorb_pub)
+ _uorb_pub(new uORB::PublicationBase(T::handle()))
{}
~PublisherUORB() {};
diff --git a/src/platforms/px4_subscriber.h b/src/platforms/px4_subscriber.h
index e086cd4c2..17a95f12d 100644
--- a/src/platforms/px4_subscriber.h
+++ b/src/platforms/px4_subscriber.h
@@ -107,21 +107,22 @@ public:
SubscriberROS(ros::NodeHandle *rnh) :
px4::Subscriber<T>(),
_cbf(NULL),
- _ros_sub(rnh->subscribe(T::handle(), 1, &SubscriberROS<T>::callback, this))
+ _ros_sub(rnh->subscribe(T::handle(), kQueueSizeDefault, &SubscriberROS<T>::callback, this))
{}
/**
* Construct Subscriber by providing a callback function
*/
- //XXX queue default
SubscriberROS(ros::NodeHandle *rnh, std::function<void(const T &)> cbf) :
_cbf(cbf),
- _ros_sub(rnh->subscribe(T::handle(), 1, &SubscriberROS<T>::callback, this))
+ _ros_sub(rnh->subscribe(T::handle(), kQueueSizeDefault, &SubscriberROS<T>::callback, this))
{}
virtual ~SubscriberROS() {};
protected:
+ static const uint32_t kQueueSizeDefault = 1; /**< Size of queue for ROS */
+
/**
* Called on topic update, saves the current message and then calls the provided callback function
* needs to use the native type as it is called by ROS