aboutsummaryrefslogtreecommitdiff
path: root/src/examples/publisher
diff options
context:
space:
mode:
authorThomas Gubler <thomasgubler@gmail.com>2014-12-11 10:51:19 +0100
committerThomas Gubler <thomasgubler@gmail.com>2014-12-11 10:51:19 +0100
commit173b1b2a8bcf2344be92b1f6e5acbc089a43fcab (patch)
tree63afb74e15312ecf8c60800962895e217c6e634c /src/examples/publisher
parenta1685ed6d093ec01214e6839ea66f9dd565e55ce (diff)
downloadpx4-firmware-173b1b2a8bcf2344be92b1f6e5acbc089a43fcab.tar.gz
px4-firmware-173b1b2a8bcf2344be92b1f6e5acbc089a43fcab.tar.bz2
px4-firmware-173b1b2a8bcf2344be92b1f6e5acbc089a43fcab.zip
WIP, make class based and extended subscriber/publisher example compile for ros
Diffstat (limited to 'src/examples/publisher')
-rw-r--r--src/examples/publisher/publisher_example.cpp2
-rw-r--r--src/examples/publisher/publisher_example.h1
-rw-r--r--src/examples/publisher/publisher_main.cpp6
3 files changed, 7 insertions, 2 deletions
diff --git a/src/examples/publisher/publisher_example.cpp b/src/examples/publisher/publisher_example.cpp
index 3c716291b..2e5779ebe 100644
--- a/src/examples/publisher/publisher_example.cpp
+++ b/src/examples/publisher/publisher_example.cpp
@@ -41,6 +41,8 @@
#include "publisher_example.h"
+using namespace px4;
+
PublisherExample::PublisherExample() :
_n(),
_rc_channels_pub(PX4_ADVERTISE(_n, rc_channels))
diff --git a/src/examples/publisher/publisher_example.h b/src/examples/publisher/publisher_example.h
index 78c1ffc89..304ecef47 100644
--- a/src/examples/publisher/publisher_example.h
+++ b/src/examples/publisher/publisher_example.h
@@ -38,6 +38,7 @@
* @author Thomas Gubler <thomasgubler@gmail.com>
*/
#include <px4.h>
+
class PublisherExample {
public:
PublisherExample();
diff --git a/src/examples/publisher/publisher_main.cpp b/src/examples/publisher/publisher_main.cpp
index c4e79aaa6..8b692d963 100644
--- a/src/examples/publisher/publisher_main.cpp
+++ b/src/examples/publisher/publisher_main.cpp
@@ -51,6 +51,7 @@ using namespace px4;
PX4_MAIN_FUNCTION(publisher);
+#if !defined(__linux) && !(defined(__APPLE__) && defined(__MACH__))
extern "C" __EXPORT int publisher_main(int argc, char *argv[])
{
px4::init(argc, argv, "publisher");
@@ -98,15 +99,16 @@ extern "C" __EXPORT int publisher_main(int argc, char *argv[])
warnx("unrecognized command");
return 1;
}
+#endif
PX4_MAIN_FUNCTION(publisher)
{
- warnx("starting");
+ PX4_INFO("starting");
PublisherExample p;
thread_running = true;
p.main();
- warnx("exiting.");
+ PX4_INFO("exiting.");
thread_running = false;
return 0;
}