mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-01 03:04:07 +08:00
add and use PX4_ROS preprocessor define
This commit is contained in:
parent
ee561947e9
commit
f37fdd95af
@ -1,6 +1,7 @@
|
||||
cmake_minimum_required(VERSION 2.8.3)
|
||||
project(px4)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
add_definitions(-D__PX4_ROS)
|
||||
|
||||
## Find catkin macros and libraries
|
||||
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
|
||||
|
||||
@ -51,7 +51,7 @@ using namespace px4;
|
||||
|
||||
PX4_MAIN_FUNCTION(publisher);
|
||||
|
||||
#if !defined(__linux) && !(defined(__APPLE__) && defined(__MACH__))
|
||||
#if !defined(__PX4_ROS)
|
||||
extern "C" __EXPORT int publisher_main(int argc, char *argv[]);
|
||||
int publisher_main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
@ -51,7 +51,7 @@ using namespace px4;
|
||||
|
||||
PX4_MAIN_FUNCTION(subscriber);
|
||||
|
||||
#if !defined(__linux) && !(defined(__APPLE__) && defined(__MACH__))
|
||||
#if !defined(__PX4_ROS)
|
||||
extern "C" __EXPORT int subscriber_main(int argc, char *argv[]);
|
||||
int subscriber_main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
@ -122,7 +122,7 @@ public:
|
||||
memcpy(data, d, sizeof(data));
|
||||
}
|
||||
|
||||
#if defined(__linux) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#if defined(__PX4_ROS)
|
||||
/**
|
||||
* set data from boost::array
|
||||
*/
|
||||
|
||||
@ -67,7 +67,7 @@ using namespace px4;
|
||||
|
||||
PX4_MAIN_FUNCTION(mc_att_control_multiplatform);
|
||||
|
||||
#if !defined(__linux) && !(defined(__APPLE__) && defined(__MACH__))
|
||||
#if !defined(__PX4_ROS)
|
||||
/**
|
||||
* Multicopter attitude control app start / stop handling function
|
||||
*
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
#define PX4_PARAM_DEFINE_FLOAT(_name) PARAM_DEFINE_FLOAT(_name, PX4_PARAM_DEFAULT_VALUE_NAME(_name))
|
||||
|
||||
|
||||
#if defined(__linux) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#if defined(__PX4_ROS)
|
||||
/*
|
||||
* Building for running within the ROS environment
|
||||
*/
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#if defined(__linux) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#if defined(__PX4_ROS)
|
||||
/*
|
||||
* Building for running within the ROS environment
|
||||
*/
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(__linux) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#if defined(__PX4_ROS)
|
||||
#define __EXPORT
|
||||
#endif
|
||||
|
||||
@ -53,7 +53,7 @@ __EXPORT void init(int argc, char *argv[], const char *process_name);
|
||||
|
||||
__EXPORT uint64_t get_time_micros();
|
||||
|
||||
#if defined(__linux) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#if defined(__PX4_ROS)
|
||||
/**
|
||||
* Returns true if the app/task should continue to run
|
||||
*/
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
#include "px4_publisher.h"
|
||||
#include "px4_middleware.h"
|
||||
|
||||
#if defined(__linux) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#if defined(__PX4_ROS)
|
||||
/* includes when building for ros */
|
||||
#include "ros/ros.h"
|
||||
#include <list>
|
||||
@ -55,7 +55,7 @@
|
||||
|
||||
namespace px4
|
||||
{
|
||||
#if defined(__linux) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#if defined(__PX4_ROS)
|
||||
class NodeHandle :
|
||||
private ros::NodeHandle
|
||||
{
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
* PX4 Middleware Wrapper Node Handle
|
||||
*/
|
||||
#pragma once
|
||||
#if defined(__linux) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#if defined(__PX4_ROS)
|
||||
/* includes when building for ros */
|
||||
#include "ros/ros.h"
|
||||
#else
|
||||
@ -60,7 +60,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
#if defined(__linux) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#if defined(__PX4_ROS)
|
||||
class Publisher :
|
||||
public PublisherBase
|
||||
{
|
||||
|
||||
@ -36,9 +36,11 @@
|
||||
*
|
||||
* PX4 Middleware Wrapper Subscriber
|
||||
*/
|
||||
#include <functional>
|
||||
#pragma once
|
||||
#if defined(__linux) || (defined(__APPLE__) && defined(__MACH__))
|
||||
|
||||
#include <functional>
|
||||
|
||||
#if defined(__PX4_ROS)
|
||||
/* includes when building for ros */
|
||||
#include "ros/ros.h"
|
||||
#else
|
||||
@ -87,7 +89,7 @@ public:
|
||||
virtual void * get_void_ptr() = 0;
|
||||
};
|
||||
|
||||
#if defined(__linux) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#if defined(__PX4_ROS)
|
||||
/**
|
||||
* Subscriber class that is templated with the ros n message type
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user