mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 16:43:34 +08:00
initial minimal PX4_ROS2 platform and px4_ros2_default build (#20689)
- new ROS2 platform in PX4 intended for creating configs that build and run entirely in ROS2 - PX4_CONFIG defaults to px4_ros2_default if no config specified and in a colcon workspace with ROS_VERSION=2 - currently doesn't do much other than allow you to build px4 msgs interface package
This commit is contained in:
@@ -39,7 +39,7 @@ add_dependencies(drivers_bootloaders prebuild_targets)
|
||||
|
||||
include_directories(include)
|
||||
target_include_directories(drivers_bootloaders INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(drivers_bootloaders PRIVATE systemlib)
|
||||
target_link_libraries(drivers_bootloaders PRIVATE crc)
|
||||
|
||||
# generate bootloader_app_shared_t
|
||||
if(NOT "${PX4_BOARD_LABEL}" MATCHES "canbootloader")
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
#include "boot_alt_app_shared.h"
|
||||
|
||||
#include <lib/systemlib/crc.h>
|
||||
#include <lib/crc/crc.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Name: bootloader_alt_app_shared_read
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#include "arm_internal.h"
|
||||
#include "boot_app_shared.h"
|
||||
|
||||
#include <lib/systemlib/crc.h>
|
||||
#include <lib/crc/crc.h>
|
||||
|
||||
#define BOOTLOADER_COMMON_APP_SIGNATURE 0xB0A04150u
|
||||
#define BOOTLOADER_COMMON_BOOTLOADER_SIGNATURE 0xB0A0424Cu
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
|
||||
#include <perf/perf_counter.h>
|
||||
#include <systemlib/err.h>
|
||||
#include <systemlib/conversions.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/clock.h>
|
||||
|
||||
+42
-41
@@ -31,44 +31,45 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
add_subdirectory(adsb)
|
||||
add_subdirectory(airspeed)
|
||||
add_subdirectory(avoidance)
|
||||
add_subdirectory(battery)
|
||||
add_subdirectory(bezier)
|
||||
add_subdirectory(button)
|
||||
add_subdirectory(cdev)
|
||||
add_subdirectory(circuit_breaker)
|
||||
add_subdirectory(collision_prevention)
|
||||
add_subdirectory(component_information)
|
||||
add_subdirectory(controllib)
|
||||
add_subdirectory(conversion)
|
||||
add_subdirectory(crypto)
|
||||
add_subdirectory(drivers)
|
||||
add_subdirectory(field_sensor_bias_estimator)
|
||||
add_subdirectory(geo)
|
||||
add_subdirectory(hysteresis)
|
||||
add_subdirectory(l1)
|
||||
add_subdirectory(led)
|
||||
add_subdirectory(matrix)
|
||||
add_subdirectory(mathlib)
|
||||
add_subdirectory(mixer_module)
|
||||
add_subdirectory(motion_planning)
|
||||
add_subdirectory(npfg)
|
||||
add_subdirectory(perf)
|
||||
add_subdirectory(pid)
|
||||
add_subdirectory(pid_design)
|
||||
add_subdirectory(rate_control)
|
||||
add_subdirectory(rc)
|
||||
add_subdirectory(sensor_calibration)
|
||||
add_subdirectory(slew_rate)
|
||||
add_subdirectory(systemlib)
|
||||
add_subdirectory(system_identification)
|
||||
add_subdirectory(tecs)
|
||||
add_subdirectory(terrain_estimation)
|
||||
add_subdirectory(timesync)
|
||||
add_subdirectory(tunes)
|
||||
add_subdirectory(version)
|
||||
add_subdirectory(weather_vane)
|
||||
add_subdirectory(wind_estimator)
|
||||
add_subdirectory(world_magnetic_model)
|
||||
add_subdirectory(adsb EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(airspeed EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(avoidance EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(battery EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(bezier EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(button EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(cdev EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(circuit_breaker EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(collision_prevention EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(component_information EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(controllib EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(conversion EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(crc EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(crypto EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(drivers EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(field_sensor_bias_estimator EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(geo EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(hysteresis EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(l1 EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(led EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(matrix EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(mathlib EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(mixer_module EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(motion_planning EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(npfg EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(perf EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(pid EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(pid_design EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(rate_control EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(rc EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(sensor_calibration EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(slew_rate EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(systemlib EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(system_identification EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(tecs EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(terrain_estimation EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(timesync EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(tunes EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(version EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(weather_vane EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(wind_estimator EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(world_magnetic_model EXCLUDE_FROM_ALL)
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015-2022 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
add_library(crc STATIC EXCLUDE_FROM_ALL
|
||||
crc.c
|
||||
crc.h
|
||||
)
|
||||
add_dependencies(crc prebuild_targets)
|
||||
target_compile_options(crc PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
|
||||
@@ -172,8 +172,8 @@ if(${PX4_PLATFORM} STREQUAL "nuttx")
|
||||
endif()
|
||||
|
||||
# TODO: find a better way to do this
|
||||
if (NOT "${PX4_BOARD}" MATCHES "px4_io")
|
||||
add_library(parameters
|
||||
if(NOT "${PX4_BOARD}" MATCHES "px4_io")
|
||||
add_library(parameters STATIC EXCLUDE_FROM_ALL
|
||||
${SRCS}
|
||||
px4_parameters.hpp
|
||||
)
|
||||
@@ -188,7 +188,7 @@ if (NOT "${PX4_BOARD}" MATCHES "px4_io")
|
||||
-Wno-sign-compare # TODO: fix and enable
|
||||
)
|
||||
else()
|
||||
add_library(parameters ${PX4_SOURCE_DIR}/platforms/common/empty.c)
|
||||
add_library(parameters STATIC EXCLUDE_FROM_ALL ${PX4_SOURCE_DIR}/platforms/common/empty.c)
|
||||
endif()
|
||||
add_dependencies(parameters prebuild_targets)
|
||||
|
||||
|
||||
@@ -32,17 +32,17 @@
|
||||
############################################################################
|
||||
|
||||
set(SRCS
|
||||
conversions.c
|
||||
conversions.h
|
||||
crc.c
|
||||
crc.h
|
||||
err.h
|
||||
mavlink_log.cpp
|
||||
mavlink_log.h
|
||||
px4_macros.h
|
||||
)
|
||||
|
||||
if(${PX4_PLATFORM} STREQUAL "nuttx")
|
||||
list(APPEND SRCS
|
||||
otp.c
|
||||
otp.h
|
||||
ppm_decode.h
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
||||
* Author: @author Lorenz Meier <lm@inf.ethz.ch>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file conversions.c
|
||||
* Implementation of commonly used conversions.
|
||||
*/
|
||||
|
||||
#include <px4_platform_common/px4_config.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "conversions.h"
|
||||
|
||||
int16_t
|
||||
int16_t_from_bytes(uint8_t bytes[])
|
||||
{
|
||||
union {
|
||||
uint8_t b[2];
|
||||
int16_t w;
|
||||
} u;
|
||||
|
||||
u.b[1] = bytes[0];
|
||||
u.b[0] = bytes[1];
|
||||
|
||||
return u.w;
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
||||
* Author: Lorenz Meier <lm@inf.ethz.ch>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file conversions.h
|
||||
* Definition of commonly used conversions.
|
||||
*
|
||||
* Includes bit / byte / geo representation and unit conversions.
|
||||
*/
|
||||
|
||||
#ifndef CONVERSIONS_H_
|
||||
#define CONVERSIONS_H_
|
||||
#include <float.h>
|
||||
#include <stdint.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Converts a signed 16 bit integer from big endian to little endian.
|
||||
*
|
||||
* This function is for commonly used 16 bit big endian sensor data,
|
||||
* delivered by driver routines as two 8 bit numbers in big endian order.
|
||||
* Common vendors with big endian representation are Invense, Bosch and
|
||||
* Honeywell. ST micro devices tend to use a little endian representation.
|
||||
*/
|
||||
__EXPORT int16_t int16_t_from_bytes(uint8_t bytes[]);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* CONVERSIONS_H_ */
|
||||
@@ -49,9 +49,8 @@
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h> // memset
|
||||
#include "conversions.h"
|
||||
#include "otp.h"
|
||||
#include "err.h" // warnx
|
||||
#include "err.h" // warnx
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user