diff options
Diffstat (limited to 'src/examples/subscriber')
-rw-r--r-- | src/examples/subscriber/subscriber_example.cpp | 19 | ||||
-rw-r--r-- | src/examples/subscriber/subscriber_example.h | 2 |
2 files changed, 12 insertions, 9 deletions
diff --git a/src/examples/subscriber/subscriber_example.cpp b/src/examples/subscriber/subscriber_example.cpp index 1c8f4c62b..c662a07ad 100644 --- a/src/examples/subscriber/subscriber_example.cpp +++ b/src/examples/subscriber/subscriber_example.cpp @@ -43,8 +43,10 @@ using namespace px4; -void rc_channels_callback_function(const PX4_TOPIC_T(rc_channels) &msg) { - PX4_INFO("I heard: [%llu]", msg.timestamp_last_valid); +// void rc_channels_callback_function(const PX4_TOPIC_T(rc_channels) &msg) { +void rc_channels_callback_function(const px4_rc_channels &msg); +void rc_channels_callback_function(const px4_rc_channels &msg) { + PX4_INFO("I heard: [%llu]", msg.data().timestamp_last_valid); } SubscriberExample::SubscriberExample() : @@ -63,7 +65,8 @@ SubscriberExample::SubscriberExample() : /* Do some subscriptions */ /* Function */ // PX4_SUBSCRIBE(_n, rc_channels, rc_channels_callback_function, _interval); - _n.subscribe<px4_rc_channels>(rc_channels_callback_function); + _n.subscribe<px4_rc_channels>(rc_channels_callback_function); //ROS version + // _n.subscribe<px4_rc_channels>(std::bind(&rc_channels_callback_function, std::placeholders::_1)); UORB version // [> Class Method <] // PX4_SUBSCRIBE(_n, rc_channels, SubscriberExample::rc_channels_callback, this, 1000); @@ -77,8 +80,8 @@ SubscriberExample::SubscriberExample() : * This tutorial demonstrates simple receipt of messages over the PX4 middleware system. * Also the current value of the _sub_rc_chan subscription is printed */ -void SubscriberExample::rc_channels_callback(const PX4_TOPIC_T(rc_channels) &msg) { - PX4_INFO("Subscriber callback: [%llu], value of _sub_rc_chan: [%llu]", - msg.timestamp_last_valid, - _sub_rc_chan->get().data().timestamp_last_valid); -} +// void SubscriberExample::rc_channels_callback(const PX4_TOPIC_T(rc_channels) &msg) { + // PX4_INFO("Subscriber callback: [%llu], value of _sub_rc_chan: [%llu]", + // msg.timestamp_last_valid, + // _sub_rc_chan->get().data().timestamp_last_valid); +// } diff --git a/src/examples/subscriber/subscriber_example.h b/src/examples/subscriber/subscriber_example.h index b52ae991b..43dafe010 100644 --- a/src/examples/subscriber/subscriber_example.h +++ b/src/examples/subscriber/subscriber_example.h @@ -59,7 +59,7 @@ protected: // px4::PX4_SUBSCRIBER(rc_channels) * _sub_rc_chan; px4::Subscriber<px4_rc_channels> * _sub_rc_chan; - void rc_channels_callback(const PX4_TOPIC_T(rc_channels) &msg); + // void rc_channels_callback(const PX4_TOPIC_T(rc_channels) &msg); }; |