diff options
author | Thomas Gubler <thomasgubler@gmail.com> | 2014-11-26 11:36:23 +0100 |
---|---|---|
committer | Thomas Gubler <thomasgubler@gmail.com> | 2014-11-26 11:36:23 +0100 |
commit | e7c1e5b1ff7b1bbdc11ab2cae6b99fe459487119 (patch) | |
tree | ed69515032079068a3f9fcbf46356a0f860e2f48 /src/examples/publisher | |
parent | 3c6f6618e8709c22ac21f8f0353f292f25da22f7 (diff) | |
download | px4-firmware-e7c1e5b1ff7b1bbdc11ab2cae6b99fe459487119.tar.gz px4-firmware-e7c1e5b1ff7b1bbdc11ab2cae6b99fe459487119.tar.bz2 px4-firmware-e7c1e5b1ff7b1bbdc11ab2cae6b99fe459487119.zip |
wip, working on the nuttx wrapper
Diffstat (limited to 'src/examples/publisher')
-rw-r--r-- | src/examples/publisher/publisher.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/examples/publisher/publisher.cpp b/src/examples/publisher/publisher.cpp index c09cca1fc..68fd8a5c3 100644 --- a/src/examples/publisher/publisher.cpp +++ b/src/examples/publisher/publisher.cpp @@ -26,14 +26,15 @@ */ #include <px4.h> -#include <px4/rc_channels.h> -#include <sstream> +using namespace px4; /** * This tutorial demonstrates simple sending of messages over the PX4 middleware system. */ -int main(int argc, char **argv) +// __EXPORT bool task_should_exit; + +PX4_MAIN_FUNCTION(publisher) { px4::init(argc, argv, "px4_publisher"); @@ -57,7 +58,7 @@ int main(int argc, char **argv) * than we can send them, the number here specifies how many messages to * buffer up before throwing some away. */ - px4::Publisher rc_channels_pub = n.advertise<px4::rc_channels>(PX4_TOPIC(rc_channels)); + px4::Publisher * rc_channels_pub = n.advertise<PX4_TOPIC_T(rc_channels)>(PX4_TOPIC(rc_channels)); px4::Rate loop_rate(10); @@ -72,7 +73,7 @@ int main(int argc, char **argv) /** * This is a message object. You stuff it with data, and then publish it. */ - px4::rc_channels msg; + PX4_TOPIC_T(rc_channels) msg; msg.timestamp_last_valid = px4::get_time_micros(); PX4_INFO("%lu", msg.timestamp_last_valid); @@ -83,7 +84,7 @@ int main(int argc, char **argv) * given as a template parameter to the advertise<>() call, as was done * in the constructor above. */ - rc_channels_pub.publish(msg); + rc_channels_pub->publish(msg); px4::spin_once(); |