mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 01:03:33 +08:00
WIP, make class based and extended subscriber/publisher example compile for ros
This commit is contained in:
@@ -41,6 +41,8 @@
|
||||
|
||||
#include "publisher_example.h"
|
||||
|
||||
using namespace px4;
|
||||
|
||||
PublisherExample::PublisherExample() :
|
||||
_n(),
|
||||
_rc_channels_pub(PX4_ADVERTISE(_n, rc_channels))
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
* @author Thomas Gubler <thomasgubler@gmail.com>
|
||||
*/
|
||||
#include <px4.h>
|
||||
|
||||
class PublisherExample {
|
||||
public:
|
||||
PublisherExample();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user