Compare commits

...

2 Commits

Author SHA1 Message Date
Daniel Agar 61778511ea lib/matrix: inline common Vector3f operators 2022-01-21 12:53:26 -05:00
Daniel Agar 56de0e27d8 PX4 ROS2 msg conformity and explicit topics
- .msg files are PascalCase
 - topics are still either per msg or explicitly listed in TOPICS
 - compatible structs are still generated (eg struct msg_s), but ROS2 style px4::msg::Msg is also available
2022-01-21 09:32:30 -05:00
398 changed files with 5623 additions and 1533 deletions
+5
View File
@@ -31,6 +31,11 @@ CONFIG:
buildType: RelWithDebInfo buildType: RelWithDebInfo
settings: settings:
CONFIG: px4_sitl_test CONFIG: px4_sitl_test
px4_ros2_default:
short: px4_ros2
buildType: RelWithDebInfo
settings:
CONFIG: px4_ros2_default
px4_io-v2_default: px4_io-v2_default:
short: px4_io-v2 short: px4_io-v2
buildType: MinSizeRel buildType: MinSizeRel
+5 -2
View File
@@ -6,7 +6,7 @@
"C_Cpp.autoAddFileAssociations": false, "C_Cpp.autoAddFileAssociations": false,
"C_Cpp.clang_format_fallbackStyle": "none", "C_Cpp.clang_format_fallbackStyle": "none",
"C_Cpp.default.browse.limitSymbolsToIncludedHeaders": true, "C_Cpp.default.browse.limitSymbolsToIncludedHeaders": true,
"C_Cpp.default.cppStandard": "c++14", "C_Cpp.default.cppStandard": "c++17",
"C_Cpp.default.cStandard": "c11", "C_Cpp.default.cStandard": "c11",
"C_Cpp.formatting": "Disabled", "C_Cpp.formatting": "Disabled",
"C_Cpp.intelliSenseEngine": "Default", "C_Cpp.intelliSenseEngine": "Default",
@@ -121,6 +121,7 @@
"variant": "cpp", "variant": "cpp",
"vector": "cpp" "vector": "cpp"
}, },
"ros.distro": "foxy",
"search.exclude": { "search.exclude": {
"${workspaceFolder}/build": true "${workspaceFolder}/build": true
}, },
@@ -136,5 +137,7 @@
"yaml.schemas": { "yaml.schemas": {
"${workspaceFolder}/validation/module_schema.yaml": "${workspaceFolder}/src/modules/*/module.yaml" "${workspaceFolder}/validation/module_schema.yaml": "${workspaceFolder}/src/modules/*/module.yaml"
}, },
"cortex-debug.openocdPath": "${env:PICO_SDK_PATH}/../openocd/src/openocd" // Added for rp2040 "python.autoComplete.extraPaths": [
"/opt/ros/foxy/lib/python3.8/site-packages"
]
} }
+170 -37
View File
@@ -101,6 +101,8 @@
cmake_minimum_required(VERSION 3.2 FATAL_ERROR) cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
cmake_policy(SET CMP0058 NEW)
set(PX4_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE FILEPATH "PX4 source directory" FORCE) set(PX4_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE FILEPATH "PX4 source directory" FORCE)
set(PX4_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE FILEPATH "PX4 binary directory" FORCE) set(PX4_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE FILEPATH "PX4 binary directory" FORCE)
@@ -124,7 +126,6 @@ define_property(GLOBAL PROPERTY PX4_MODULE_LIBRARIES
BRIEF_DOCS "PX4 module libs" BRIEF_DOCS "PX4 module libs"
FULL_DOCS "List of all PX4 module libraries" FULL_DOCS "List of all PX4 module libraries"
) )
define_property(GLOBAL PROPERTY PX4_MODULE_PATHS define_property(GLOBAL PROPERTY PX4_MODULE_PATHS
BRIEF_DOCS "PX4 module paths" BRIEF_DOCS "PX4 module paths"
FULL_DOCS "List of paths to all PX4 modules" FULL_DOCS "List of paths to all PX4 modules"
@@ -133,29 +134,40 @@ define_property(GLOBAL PROPERTY PX4_SRC_FILES
BRIEF_DOCS "src files from all PX4 modules & libs" BRIEF_DOCS "src files from all PX4 modules & libs"
FULL_DOCS "SRC files from px4_add_{module,library}" FULL_DOCS "SRC files from px4_add_{module,library}"
) )
define_property(GLOBAL PROPERTY PX4_PUBLICATIONS
BRIEF_DOCS "PX4 publication topics"
FULL_DOCS "List of topics published by PX4 modules"
)
define_property(GLOBAL PROPERTY PX4_SUBSCRIPTIONS
BRIEF_DOCS "PX4 subscription topics"
FULL_DOCS "List of topics subscribed by PX4 modules"
)
#============================================================================= #=============================================================================
# configuration # configuration
# #
set(CONFIG "px4_sitl_default" CACHE STRING "desired configuration") # default to px4_ros2_default if building within a ROS2 colcon environment
if((DEFINED ENV{COLCON_PREFIX_PATH}) AND (DEFINED ENV{ROS_VERSION}))
if("$ENV{ROS_VERSION}" MATCHES "2")
message(STATUS "ROS_VERSION: $ENV{ROS_VERSION}")
set(CONFIG "px4_ros2_default" CACHE STRING "desired configuration") # TODO
endif()
endif()
if(NOT CONFIG)
set(CONFIG "px4_sitl_default" CACHE STRING "desired configuration")
endif()
include(px4_add_module) include(px4_add_module)
set(config_module_list) set(config_module_list)
# Find Python # Find Python
# If using catkin, Python 2 is found since it points find_package(PythonInterp 3)
# to the Python libs installed with the ROS distro # We have a custom error message to tell users how to install python3.
if (NOT CATKIN_DEVEL_PREFIX) if(NOT PYTHONINTERP_FOUND)
find_package(PythonInterp 3) message(FATAL_ERROR "Python 3 not found. Please install Python 3:\n"
# We have a custom error message to tell users how to install python3. " Ubuntu: sudo apt install python3 python3-dev python3-pip\n"
if (NOT PYTHONINTERP_FOUND) " macOS: brew install python")
message(FATAL_ERROR "Python 3 not found. Please install Python 3:\n"
" Ubuntu: sudo apt install python3 python3-dev python3-pip\n"
" macOS: brew install python")
endif()
else()
find_package(PythonInterp REQUIRED)
endif() endif()
option(PYTHON_COVERAGE "Python code coverage" OFF) option(PYTHON_COVERAGE "Python code coverage" OFF)
@@ -191,10 +203,6 @@ set_property(GLOBAL PROPERTY PX4_MODULE_CONFIG_FILES)
include(platforms/${PX4_PLATFORM}/cmake/px4_impl_os.cmake) include(platforms/${PX4_PLATFORM}/cmake/px4_impl_os.cmake)
list(APPEND CMAKE_MODULE_PATH ${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/cmake) list(APPEND CMAKE_MODULE_PATH ${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/cmake)
if(EXISTS "${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/cmake/init.cmake")
include(init)
endif()
# CMake build type (Debug Release RelWithDebInfo MinSizeRel Coverage) # CMake build type (Debug Release RelWithDebInfo MinSizeRel Coverage)
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
if(${PX4_PLATFORM} STREQUAL "nuttx") if(${PX4_PLATFORM} STREQUAL "nuttx")
@@ -230,7 +238,7 @@ project(px4 CXX C ASM)
set(package-contact "px4users@googlegroups.com") set(package-contact "px4users@googlegroups.com")
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_C_STANDARD_REQUIRED ON)
@@ -246,6 +254,10 @@ else()
SET(BUILD_SHARED_LIBS OFF) SET(BUILD_SHARED_LIBS OFF)
endif() endif()
if(EXISTS "${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/cmake/init.cmake")
include(init)
endif()
#============================================================================= #=============================================================================
# gold linker - use if available (posix only for now) # gold linker - use if available (posix only for now)
@@ -315,13 +327,6 @@ if(NOT PX4_CHIP)
message(FATAL_ERROR "px4_os_determine_build_chip() needs to set PX4_CHIP") message(FATAL_ERROR "px4_os_determine_build_chip() needs to set PX4_CHIP")
endif() endif()
#=============================================================================
# build flags
#
include(px4_add_common_flags)
px4_add_common_flags()
px4_os_add_flags()
#============================================================================= #=============================================================================
# board cmake init (optional) # board cmake init (optional)
# #
@@ -329,6 +334,13 @@ if(EXISTS ${PX4_BOARD_DIR}/cmake/init.cmake)
include(${PX4_BOARD_DIR}/cmake/init.cmake) include(${PX4_BOARD_DIR}/cmake/init.cmake)
endif() endif()
#=============================================================================
# build flags
#
include(px4_add_common_flags)
px4_add_common_flags()
px4_os_add_flags()
#============================================================================= #=============================================================================
# message, and airframe generation # message, and airframe generation
# #
@@ -410,8 +422,13 @@ add_library(parameters_interface INTERFACE)
include(px4_add_library) include(px4_add_library)
add_subdirectory(src/lib EXCLUDE_FROM_ALL) add_subdirectory(src/lib EXCLUDE_FROM_ALL)
add_subdirectory(platforms/${PX4_PLATFORM}/src/px4) add_subdirectory(platforms/${PX4_PLATFORM}/src/px4 EXCLUDE_FROM_ALL)
add_subdirectory(platforms EXCLUDE_FROM_ALL)
if(${PX4_PLATFORM} MATCHES "ros2") # TODO: fix
add_subdirectory(platforms/common/work_queue EXCLUDE_FROM_ALL)
else()
add_subdirectory(platforms EXCLUDE_FROM_ALL)
endif()
if(EXISTS "${PX4_BOARD_DIR}/CMakeLists.txt") if(EXISTS "${PX4_BOARD_DIR}/CMakeLists.txt")
add_subdirectory(${PX4_BOARD_DIR}) add_subdirectory(${PX4_BOARD_DIR})
@@ -433,6 +450,126 @@ target_link_libraries(parameters_interface INTERFACE parameters)
# firmware added last to generate the builtin for included modules # firmware added last to generate the builtin for included modules
add_subdirectory(platforms/${PX4_PLATFORM}) add_subdirectory(platforms/${PX4_PLATFORM})
set(PX4_ORB_TOPIC_COUNT 0)
if(${PX4_PLATFORM} MATCHES "ros2") # TODO: fix
configure_file(${CMAKE_SOURCE_DIR}/build/px4_fmu-v5x_default/uORBTopics.cpp ${CMAKE_BINARY_DIR}/uORBTopics.cpp COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/build/px4_fmu-v5x_default/uORBTopics.hpp ${CMAKE_BINARY_DIR}/uORBTopics.hpp COPYONLY)
set(PX4_ORB_TOPIC_COUNT 1)
else()
get_property(publications GLOBAL PROPERTY PX4_PUBLICATIONS)
get_property(subscriptions GLOBAL PROPERTY PX4_SUBSCRIPTIONS)
# TODO: for now combine subsriptions and publications for complete topic list
list(APPEND publications ${subscriptions})
list(SORT publications)
list(REMOVE_DUPLICATES publications)
set(pub_all_topics)
set(PX4_MSG_TYPE_ID)
set(PX4_MSG_TOPIC_ID)
set(PX4_MSG_TOPIC_ID_STRING)
set(PX4_MSG_TOPIC_ORB_ID)
set(PX4_ORB_DECLARE_STR)
set(PX4_ORB_DEFINE_STR)
set(PX4_ORB_HEADER_INCLUDE_STR)
foreach(pub ${publications})
#message(STATUS "pub: ${pub}")
string(REPLACE " /" ";" pub ${pub})
list(GET pub 0 pub_type)
list(GET pub 1 pub_topic)
string(REPLACE "::" ";" pub_type_split ${pub_type})
list(GET pub_type_split 2 pub_type_simple_lower)
# Pascal case to snake case (PubType -> pub_type)
string(REGEX REPLACE "(.)([A-Z][a-z]+)" "\\1_\\2" pub_type_simple_lower "${pub_type_simple_lower}")
string(REGEX REPLACE "([a-z0-9])([A-Z])" "\\1_\\2" pub_type_simple_lower "${pub_type_simple_lower}")
string(TOLOWER "${pub_type_simple_lower}" pub_type_simple_lower)
#message(STATUS "pub: Type: ${pub_type}, Topic: ${pub_topic} (${pub_type_simple_lower})")
# pub_type to include path (eg px4::msg::VehicleStatus => px4/msg/vehicle_status.hpp)
# temporary create px4/msg/vehicle_status.hpp which simply includes <uORB/topics/vehicle_status.h>
list(APPEND pub_all_topics ${pub_topic})
list(APPEND PX4_MSG_TYPE_ID ${pub_type})
#list(APPEND PX4_MSG_TOPIC_ID ${pub_topic})
set(PX4_MSG_TOPIC_ID "${PX4_MSG_TOPIC_ID}\t${pub_topic},\n")
#set(PX4_MSG_TOPIC_ID_STRING "${PX4_MSG_TOPIC_ID_STRING}\t"case ORB_ID::${pub_topic}: return \"${pub_topic}\";"\n")
set(PX4_MSG_TOPIC_ORB_ID "${PX4_MSG_TOPIC_ORB_ID}\tORB_ID(${pub_topic}),\n")
list(APPEND PX4_MSG_TOPIC_ID_STRING
"case ORB_ID::${pub_topic}: return \"${pub_topic}\";\n"
)
# PX4_MSG_TYPE_ID
# PX4_MSG_TOPIC_ID
# .h ORB_DECLARE(actuator_controls_0);
# .c ORB_DEFINE(actuator_controls_0, struct actuator_controls_s, 48, __orb_actuator_controls_fields, static_cast<uint8_t>(ORB_ID::actuator_controls_0));
set(PX4_ORB_DECLARE_STR
"${PX4_ORB_DECLARE_STR}ORB_DECLARE(${pub_topic});\n")
# ORB_DEFINE(actuator_armed, struct actuator_armed_s, 16, __orb_actuator_armed_fields, static_cast<uint8_t>(ORB_ID::actuator_armed));
set(PX4_ORB_DEFINE_STR
"${PX4_ORB_DEFINE_STR}ORB_DEFINE(${pub_topic}, ${pub_type}, px4_embedded::${pub_type_simple_lower}_s::SIZE_NO_PADDING, px4_embedded::${pub_type_simple_lower}_s::FIELDS, static_cast<uint8_t>(ORB_ID::${pub_topic}));\n")
set(PX4_ORB_HEADER_INCLUDE_STR
"${PX4_ORB_HEADER_INCLUDE_STR}#include <uORB/topics/${pub_type_simple_lower}.h>\n")
math(EXPR PX4_ORB_TOPIC_COUNT "${PX4_ORB_TOPIC_COUNT}+1")
endforeach()
list(REMOVE_DUPLICATES PX4_MSG_TYPE_ID)
#list(REMOVE_DUPLICATES PX4_MSG_TOPIC_ID)
#message(STATUS "PX4_MSG_TYPE_ID: ${PX4_MSG_TYPE_ID}")
#message(STATUS "PX4_MSG_TOPIC_ID: ${PX4_MSG_TOPIC_ID}")
if(PX4_ORB_TOPIC_COUNT GREATER 0)
configure_file(uORBTopics.cpp.in ${CMAKE_BINARY_DIR}/uORBTopics.cpp)
configure_file(uORBTopics.hpp.in ${CMAKE_BINARY_DIR}/uORBTopics.hpp)
endif()
# .hpp enum ORB_ID
# .cpp struct orb_metadat ORB_ID() array
foreach(f ${msg_files})
#message(STATUS "MSG: ${f}")
endforeach()
endif()
if(PX4_ORB_TOPIC_COUNT GREATER 0)
add_library(uorb_msgs ${uorb_headers} ${CMAKE_BINARY_DIR}/uORBTopics.cpp ${CMAKE_BINARY_DIR}/uORBTopics.hpp)
add_dependencies(uorb_msgs prebuild_targets uorb_headers)
endif()
if(${PX4_PLATFORM} MATCHES "ros2") # TODO: fix
ament_target_dependencies(uorb_msgs rclcpp std_msgs)
rosidl_target_interfaces(uorb_msgs ${PROJECT_NAME} "rosidl_typesupport_cpp")
endif()
#============================================================================= #=============================================================================
# uORB graph generation: add a custom target 'uorb_graph' # uORB graph generation: add a custom target 'uorb_graph'
# #
@@ -460,17 +597,13 @@ include(doxygen)
include(metadata) include(metadata)
include(package) include(package)
# print size
add_custom_target(size
COMMAND size $<TARGET_FILE:px4>
DEPENDS px4
WORKING_DIRECTORY ${PX4_BINARY_DIR}
USES_TERMINAL
)
# install python requirements using configured python # install python requirements using configured python
add_custom_target(install_python_requirements add_custom_target(install_python_requirements
COMMAND ${PYTHON_EXECUTABLE} -m pip install --requirement ${PX4_SOURCE_DIR}/Tools/setup/requirements.txt COMMAND ${PYTHON_EXECUTABLE} -m pip install --requirement ${PX4_SOURCE_DIR}/Tools/setup/requirements.txt
DEPENDS ${PX4_SOURCE_DIR}/Tools/setup/requirements.txt DEPENDS ${PX4_SOURCE_DIR}/Tools/setup/requirements.txt
USES_TERMINAL USES_TERMINAL
) )
if(EXISTS "${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/cmake/finalize.cmake")
include(finalize)
endif()
+3
View File
@@ -17,6 +17,8 @@ menu "Toolchain"
bool "posix" bool "posix"
config PLATFORM_QURT config PLATFORM_QURT
bool "qurt" bool "qurt"
config PLATFORM_ROS2
bool "ros2"
endchoice endchoice
config BOARD_PLATFORM config BOARD_PLATFORM
@@ -24,6 +26,7 @@ menu "Toolchain"
default "nuttx" if PLATFORM_NUTTX default "nuttx" if PLATFORM_NUTTX
default "posix" if PLATFORM_POSIX default "posix" if PLATFORM_POSIX
default "qurt" if PLATFORM_QURT default "qurt" if PLATFORM_QURT
default "ros2" if PLATFORM_ROS2
config BOARD_LOCKSTEP config BOARD_LOCKSTEP
bool "Force enable lockstep" bool "Force enable lockstep"
+1 -1
View File
@@ -479,7 +479,7 @@ clang-tidy-quiet: px4_sitl_default-clang
# TODO: Fix cppcheck errors then try --enable=warning,performance,portability,style,unusedFunction or --enable=all # TODO: Fix cppcheck errors then try --enable=warning,performance,portability,style,unusedFunction or --enable=all
cppcheck: px4_sitl_default cppcheck: px4_sitl_default
@mkdir -p "$(SRC_DIR)"/build/cppcheck @mkdir -p "$(SRC_DIR)"/build/cppcheck
@cppcheck -i"$(SRC_DIR)"/src/examples --enable=performance --std=c++14 --std=c99 --std=posix --project="$(SRC_DIR)"/build/px4_sitl_default/compile_commands.json --xml-version=2 2> "$(SRC_DIR)"/build/cppcheck/cppcheck-result.xml > /dev/null @cppcheck -i"$(SRC_DIR)"/src/examples --enable=performance --std=c++17 --std=c99 --std=posix --project="$(SRC_DIR)"/build/px4_sitl_default/compile_commands.json --xml-version=2 2> "$(SRC_DIR)"/build/cppcheck/cppcheck-result.xml > /dev/null
@cppcheck-htmlreport --source-encoding=ascii --file="$(SRC_DIR)"/build/cppcheck/cppcheck-result.xml --report-dir="$(SRC_DIR)"/build/cppcheck --source-dir="$(SRC_DIR)"/src/ @cppcheck-htmlreport --source-encoding=ascii --file="$(SRC_DIR)"/build/cppcheck/cppcheck-result.xml --report-dir="$(SRC_DIR)"/build/cppcheck --source-dir="$(SRC_DIR)"/src/
shellcheck_all: shellcheck_all:
@@ -44,4 +44,6 @@ px4_add_module(
syslink.c syslink.c
DEPENDS DEPENDS
battery battery
SUBSCRIPTIONS
"px4::msg::BatteryStatus /battery_status"
) )
@@ -3,4 +3,3 @@ CONFIG_BOARD_ARCHITECTURE="cortex-m7"
CONFIG_BOARD_ROMFSROOT="" CONFIG_BOARD_ROMFSROOT=""
CONFIG_BOARD_CONSTRAINED_MEMORY=y CONFIG_BOARD_CONSTRAINED_MEMORY=y
CONFIG_DRIVERS_BOOTLOADERS=y CONFIG_DRIVERS_BOOTLOADERS=y
CONFIG_DRIVERS_LIGHTS_RGBLED_NCP5623C=y
@@ -44,6 +44,7 @@ if("${PX4_BOARD_LABEL}" STREQUAL "canbootloader")
nuttx_arch nuttx_arch
nuttx_drivers nuttx_drivers
canbootloader canbootloader
drivers__device
) )
target_include_directories(drivers_board PRIVATE ${PX4_SOURCE_DIR}/platforms/nuttx/src/canbootloader) target_include_directories(drivers_board PRIVATE ${PX4_SOURCE_DIR}/platforms/nuttx/src/canbootloader)
+1
View File
@@ -0,0 +1 @@
CONFIG_PLATFORM_ROS2=y
+36
View File
@@ -0,0 +1,36 @@
############################################################################
#
# Copyright (c) 2021 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(drivers_board
init.cpp
)
@@ -1,7 +1,6 @@
/**************************************************************************** /****************************************************************************
* *
* Copyright (C) 2012 PX4 Development Team. All rights reserved. * Copyright (c) 2021 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 * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@@ -33,25 +32,19 @@
****************************************************************************/ ****************************************************************************/
/** /**
* @file conversions.c * @file board_config.h
* Implementation of commonly used conversions. *
* SITL internal definitions
*/ */
#include <px4_platform_common/px4_config.h> #pragma once
#include <float.h>
#include "conversions.h" #define BOARD_OVERRIDE_UUID "SIMULATIONID0000" // must be of length 16
#define PX4_SOC_ARCH_ID PX4_SOC_ARCH_ID_SITL
int16_t #define BOARD_HAS_POWER_CONTROL 1
int16_t_from_bytes(uint8_t bytes[])
{
union {
uint8_t b[2];
int16_t w;
} u;
u.b[1] = bytes[0]; #define BOARD_NUMBER_BRICKS 0
u.b[0] = bytes[1];
return u.w; #include <system_config.h>
} #include <px4_platform_common/board_common.h>
+4 -1
View File
@@ -57,4 +57,7 @@ else()
endif() endif()
include(CPack) include(CPack)
include(bloaty)
if(${PX4_PLATFORM} MATCHES "nuttx")
include(bloaty)
endif()
+10 -10
View File
@@ -71,11 +71,11 @@ function(px4_add_common_flags)
-Werror -Werror
-Warray-bounds -Warray-bounds
-Wcast-align #-Wcast-align # TODO
-Wdisabled-optimization -Wdisabled-optimization
-Wdouble-promotion -Wdouble-promotion
-Wfatal-errors -Wfatal-errors
-Wfloat-equal #-Wfloat-equal
-Wformat-security -Wformat-security
-Winit-self -Winit-self
-Wlogical-op -Wlogical-op
@@ -156,9 +156,6 @@ function(px4_add_common_flags)
# CXX only flags # CXX only flags
set(cxx_flags) set(cxx_flags)
list(APPEND cxx_flags list(APPEND cxx_flags
-fno-exceptions
-fno-threadsafe-statics
-Wreorder -Wreorder
# disabled warnings # disabled warnings
@@ -175,16 +172,19 @@ function(px4_add_common_flags)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:${flag}>) add_compile_options($<$<COMPILE_LANGUAGE:CXX>:${flag}>)
endforeach() endforeach()
if(NOT (${PX4_PLATFORM} MATCHES "ros2")) # TODO: fix
include_directories(
${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/src/px4/${PX4_CHIP_MANUFACTURER}/${PX4_CHIP}/include
${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/src/px4/common/include
${PX4_SOURCE_DIR}/platforms/common
${PX4_SOURCE_DIR}/platforms/common/include
)
endif()
include_directories( include_directories(
${PX4_BINARY_DIR} ${PX4_BINARY_DIR}
${PX4_BINARY_DIR}/src/lib ${PX4_BINARY_DIR}/src/lib
${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/src/px4/${PX4_CHIP_MANUFACTURER}/${PX4_CHIP}/include
${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/src/px4/common/include
${PX4_SOURCE_DIR}/platforms/common
${PX4_SOURCE_DIR}/platforms/common/include
${PX4_SOURCE_DIR}/src ${PX4_SOURCE_DIR}/src
${PX4_SOURCE_DIR}/src/include ${PX4_SOURCE_DIR}/src/include
${PX4_SOURCE_DIR}/src/lib ${PX4_SOURCE_DIR}/src/lib
+4 -1
View File
@@ -39,7 +39,10 @@ include(px4_list_make_absolute)
# Like add_library but with PX4 platform dependencies # Like add_library but with PX4 platform dependencies
# #
function(px4_add_library target) function(px4_add_library target)
add_library(${target} EXCLUDE_FROM_ALL ${ARGN}) add_library(${target} STATIC
EXCLUDE_FROM_ALL
${ARGN}
)
target_compile_definitions(${target} PRIVATE MODULE_NAME="${target}") target_compile_definitions(${target} PRIVATE MODULE_NAME="${target}")
+20 -3
View File
@@ -48,6 +48,7 @@ include(px4_list_make_absolute)
# [ DEPENDS <string> ] # [ DEPENDS <string> ]
# [ SRCS <list> ] # [ SRCS <list> ]
# [ MODULE_CONFIG <list> ] # [ MODULE_CONFIG <list> ]
# [ PUBLICATIONS <list> ]
# [ EXTERNAL ] # [ EXTERNAL ]
# [ DYNAMIC ] # [ DYNAMIC ]
# ) # )
@@ -64,6 +65,8 @@ include(px4_list_make_absolute)
# MODULE_CONFIG : yaml config file(s) # MODULE_CONFIG : yaml config file(s)
# INCLUDES : include directories # INCLUDES : include directories
# DEPENDS : targets which this module depends on # DEPENDS : targets which this module depends on
# PUBLICATIONS : List of publications from this module
# SUBSCRIPTIONS : List of subsriptions used by this module
# EXTERNAL : flag to indicate that this module is out-of-tree # EXTERNAL : flag to indicate that this module is out-of-tree
# DYNAMIC : don't compile into the px4 binary, but build a separate dynamically loadable module (posix) # DYNAMIC : don't compile into the px4 binary, but build a separate dynamically loadable module (posix)
# UNITY_BUILD : merge all source files and build this module as a single compilation unit # UNITY_BUILD : merge all source files and build this module as a single compilation unit
@@ -86,7 +89,7 @@ function(px4_add_module)
px4_parse_function_args( px4_parse_function_args(
NAME px4_add_module NAME px4_add_module
ONE_VALUE MODULE MAIN STACK_MAIN STACK_MAX PRIORITY ONE_VALUE MODULE MAIN STACK_MAIN STACK_MAX PRIORITY
MULTI_VALUE COMPILE_FLAGS LINK_FLAGS SRCS INCLUDES DEPENDS MODULE_CONFIG MULTI_VALUE COMPILE_FLAGS LINK_FLAGS SRCS INCLUDES DEPENDS MODULE_CONFIG PUBLICATIONS SUBSCRIPTIONS
OPTIONS EXTERNAL DYNAMIC UNITY_BUILD OPTIONS EXTERNAL DYNAMIC UNITY_BUILD
REQUIRED MODULE MAIN REQUIRED MODULE MAIN
ARGN ${ARGN}) ARGN ${ARGN})
@@ -165,7 +168,7 @@ function(px4_add_module)
# set defaults if not set # set defaults if not set
set(MAIN_DEFAULT MAIN-NOTFOUND) set(MAIN_DEFAULT MAIN-NOTFOUND)
set(STACK_MAIN_DEFAULT 2048) set(STACK_MAIN_DEFAULT 4096)
set(PRIORITY_DEFAULT SCHED_PRIORITY_DEFAULT) set(PRIORITY_DEFAULT SCHED_PRIORITY_DEFAULT)
foreach(property MAIN STACK_MAIN PRIORITY) foreach(property MAIN STACK_MAIN PRIORITY)
@@ -214,7 +217,21 @@ function(px4_add_module)
endforeach() endforeach()
endif() endif()
foreach (prop LINK_FLAGS STACK_MAIN MAIN PRIORITY) if(PUBLICATIONS)
foreach(publication ${PUBLICATIONS})
#message(STATUS "${MODULE} PUBLICATION: ${publication}")
set_property(GLOBAL APPEND PROPERTY PX4_PUBLICATIONS ${publication})
endforeach()
endif()
if(SUBSCRIPTIONS)
foreach(subscription ${SUBSCRIPTIONS})
#message(STATUS "${MODULE} SUBSCRIPTION: ${subscription}")
set_property(GLOBAL APPEND PROPERTY PX4_SUBSCRIPTIONS ${subscription})
endforeach()
endif()
foreach(prop LINK_FLAGS STACK_MAIN MAIN PRIORITY)
if (${prop}) if (${prop})
set_target_properties(${MODULE} PROPERTIES ${prop} ${${prop}}) set_target_properties(${MODULE} PROPERTIES ${prop} ${${prop}})
endif() endif()
+6 -6
View File
@@ -63,9 +63,9 @@ if(NOT PX4_CONFIG_FILE)
) )
set(PX4_CONFIG_FILE "${PX4_SOURCE_DIR}/boards/${filename}" CACHE FILEPATH "path to PX4 CONFIG file" FORCE) set(PX4_CONFIG_FILE "${PX4_SOURCE_DIR}/boards/${filename}" CACHE FILEPATH "path to PX4 CONFIG file" FORCE)
set(PX4_BOARD_DIR "${PX4_SOURCE_DIR}/boards/${vendor}/${model}" CACHE STRING "PX4 board directory" FORCE) set(PX4_BOARD_DIR "${PX4_SOURCE_DIR}/boards/${vendor}/${model}" CACHE STRING "PX4 board directory" FORCE)
set(MODEL "${model}" CACHE STRING "PX4 board model" FORCE) set(MODEL "${model}" CACHE STRING "PX4 board model" FORCE)
set(VENDOR "${vendor}" CACHE STRING "PX4 board vendor" FORCE) set(VENDOR "${vendor}" CACHE STRING "PX4 board vendor" FORCE)
set(LABEL "${label}" CACHE STRING "PX4 board vendor" FORCE) set(LABEL "${label}" CACHE STRING "PX4 board vendor" FORCE)
break() break()
endif() endif()
@@ -76,9 +76,9 @@ if(NOT PX4_CONFIG_FILE)
) )
set(PX4_CONFIG_FILE "${PX4_SOURCE_DIR}/boards/${filename}" CACHE FILEPATH "path to PX4 CONFIG file" FORCE) set(PX4_CONFIG_FILE "${PX4_SOURCE_DIR}/boards/${filename}" CACHE FILEPATH "path to PX4 CONFIG file" FORCE)
set(PX4_BOARD_DIR "${PX4_SOURCE_DIR}/boards/${vendor}/${model}" CACHE STRING "PX4 board directory" FORCE) set(PX4_BOARD_DIR "${PX4_SOURCE_DIR}/boards/${vendor}/${model}" CACHE STRING "PX4 board directory" FORCE)
set(MODEL "${model}" CACHE STRING "PX4 board model" FORCE) set(MODEL "${model}" CACHE STRING "PX4 board model" FORCE)
set(VENDOR "${vendor}" CACHE STRING "PX4 board vendor" FORCE) set(VENDOR "${vendor}" CACHE STRING "PX4 board vendor" FORCE)
set(LABEL "${label}" CACHE STRING "PX4 board vendor" FORCE) set(LABEL "${label}" CACHE STRING "PX4 board vendor" FORCE)
break() break()
endif() endif()
endif() endif()
-114
View File
@@ -1,114 +0,0 @@
<?xml version="1.0"?>
<launch>
<!-- MAVROS posix SITL environment launch script -->
<!-- launches Gazebo environment and 2x: MAVROS, PX4 SITL, and spawns vehicle -->
<!-- vehicle model and world -->
<arg name="est" default="ekf2"/>
<arg name="vehicle" default="iris"/>
<arg name="world" default="$(find mavlink_sitl_gazebo)/worlds/empty.world"/>
<!-- gazebo configs -->
<arg name="gui" default="true"/>
<arg name="debug" default="false"/>
<arg name="verbose" default="false"/>
<arg name="paused" default="false"/>
<!-- Gazebo sim -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="gui" value="$(arg gui)"/>
<arg name="world_name" value="$(arg world)"/>
<arg name="debug" value="$(arg debug)"/>
<arg name="verbose" value="$(arg verbose)"/>
<arg name="paused" value="$(arg paused)"/>
</include>
<!-- UAV0 -->
<group ns="uav0">
<!-- MAVROS and vehicle configs -->
<arg name="ID" value="0"/>
<arg name="fcu_url" default="udp://:14540@localhost:14580"/>
<!-- PX4 SITL and vehicle spawn -->
<include file="$(find px4)/launch/single_vehicle_spawn.launch">
<arg name="x" value="0"/>
<arg name="y" value="0"/>
<arg name="z" value="0"/>
<arg name="R" value="0"/>
<arg name="P" value="0"/>
<arg name="Y" value="0"/>
<arg name="vehicle" value="$(arg vehicle)"/>
<arg name="mavlink_udp_port" value="14560"/>
<arg name="mavlink_tcp_port" value="4560"/>
<arg name="ID" value="$(arg ID)"/>
<arg name="gst_udp_port" value="$(eval 5600 + arg('ID'))"/>
<arg name="video_uri" value="$(eval 5600 + arg('ID'))"/>
<arg name="mavlink_cam_udp_port" value="$(eval 14530 + arg('ID'))"/>
</include>
<!-- MAVROS -->
<include file="$(find mavros)/launch/px4.launch">
<arg name="fcu_url" value="$(arg fcu_url)"/>
<arg name="gcs_url" value=""/>
<arg name="tgt_system" value="$(eval 1 + arg('ID'))"/>
<arg name="tgt_component" value="1"/>
</include>
</group>
<!-- UAV1 -->
<group ns="uav1">
<!-- MAVROS and vehicle configs -->
<arg name="ID" value="1"/>
<arg name="fcu_url" default="udp://:14541@localhost:14581"/>
<!-- PX4 SITL and vehicle spawn -->
<include file="$(find px4)/launch/single_vehicle_spawn.launch">
<arg name="x" value="1"/>
<arg name="y" value="0"/>
<arg name="z" value="0"/>
<arg name="R" value="0"/>
<arg name="P" value="0"/>
<arg name="Y" value="0"/>
<arg name="vehicle" value="$(arg vehicle)"/>
<arg name="mavlink_udp_port" value="14561"/>
<arg name="mavlink_tcp_port" value="4561"/>
<arg name="ID" value="$(arg ID)"/>
<arg name="gst_udp_port" value="$(eval 5600 + arg('ID'))"/>
<arg name="video_uri" value="$(eval 5600 + arg('ID'))"/>
<arg name="mavlink_cam_udp_port" value="$(eval 14530 + arg('ID'))"/>
</include>
<!-- MAVROS -->
<include file="$(find mavros)/launch/px4.launch">
<arg name="fcu_url" value="$(arg fcu_url)"/>
<arg name="gcs_url" value=""/>
<arg name="tgt_system" value="$(eval 1 + arg('ID'))"/>
<arg name="tgt_component" value="1"/>
</include>
</group>
<!-- UAV2 -->
<group ns="uav2">
<!-- MAVROS and vehicle configs -->
<arg name="ID" value="2"/>
<arg name="fcu_url" default="udp://:14542@localhost:14582"/>
<!-- PX4 SITL and vehicle spawn -->
<include file="$(find px4)/launch/single_vehicle_spawn.launch">
<arg name="x" value="0"/>
<arg name="y" value="1"/>
<arg name="z" value="0"/>
<arg name="R" value="0"/>
<arg name="P" value="0"/>
<arg name="Y" value="0"/>
<arg name="vehicle" value="$(arg vehicle)"/>
<arg name="mavlink_udp_port" value="14562"/>
<arg name="mavlink_tcp_port" value="4562"/>
<arg name="ID" value="$(arg ID)"/>
<arg name="gst_udp_port" value="$(eval 5600 + arg('ID'))"/>
<arg name="video_uri" value="$(eval 5600 + arg('ID'))"/>
<arg name="mavlink_cam_udp_port" value="$(eval 14530 + arg('ID'))"/>
</include>
<!-- MAVROS -->
<include file="$(find mavros)/launch/px4.launch">
<arg name="fcu_url" value="$(arg fcu_url)"/>
<arg name="gcs_url" value=""/>
<arg name="tgt_system" value="$(eval 1 + arg('ID'))"/>
<arg name="tgt_component" value="1"/>
</include>
</group>
</launch>
<!-- to add more UAVs (up to 10):
Increase the id
Change the name space
Set the FCU to default="udp://:14540+id@localhost:14550+id"
Set the malink_udp_port to 14560+id) -->
-105
View File
@@ -1,105 +0,0 @@
<?xml version="1.0"?>
<launch>
<!-- MAVROS posix SITL environment launch script -->
<!-- launches Gazebo environment and 2x: MAVROS, PX4 SITL, and spawns vehicle -->
<!-- vehicle model and world -->
<arg name="est" default="ekf2"/>
<arg name="vehicle" default="plane"/>
<arg name="world" default="$(find mavlink_sitl_gazebo)/worlds/empty.world"/>
<!-- gazebo configs -->
<arg name="gui" default="true"/>
<arg name="debug" default="false"/>
<arg name="verbose" default="false"/>
<arg name="paused" default="false"/>
<!-- Gazebo sim -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="gui" value="$(arg gui)"/>
<arg name="world_name" value="$(arg world)"/>
<arg name="debug" value="$(arg debug)"/>
<arg name="verbose" value="$(arg verbose)"/>
<arg name="paused" value="$(arg paused)"/>
</include>
<!-- UAV0 -->
<group ns="uav0">
<!-- MAVROS and vehicle configs -->
<arg name="ID" value="0"/>
<arg name="fcu_url" default="udp://:14540@localhost:14580"/>
<!-- PX4 SITL and vehicle spawn -->
<include file="$(find px4)/launch/single_vehicle_spawn_sdf.launch">
<arg name="x" value="0"/>
<arg name="y" value="0"/>
<arg name="z" value="0"/>
<arg name="R" value="0"/>
<arg name="P" value="0"/>
<arg name="Y" value="0"/>
<arg name="vehicle" value="$(arg vehicle)"/>
<arg name="mavlink_udp_port" value="14560"/>
<arg name="mavlink_tcp_port" value="4560"/>
<arg name="ID" value="$(arg ID)"/>
</include>
<!-- MAVROS -->
<include file="$(find mavros)/launch/px4.launch">
<arg name="fcu_url" value="$(arg fcu_url)"/>
<arg name="gcs_url" value=""/>
<arg name="tgt_system" value="$(eval 1 + arg('ID'))"/>
<arg name="tgt_component" value="1"/>
</include>
</group>
<!-- UAV1 -->
<group ns="uav1">
<!-- MAVROS and vehicle configs -->
<arg name="ID" value="1"/>
<arg name="fcu_url" default="udp://:14541@localhost:14581"/>
<!-- PX4 SITL and vehicle spawn -->
<include file="$(find px4)/launch/single_vehicle_spawn_sdf.launch">
<arg name="x" value="1"/>
<arg name="y" value="0"/>
<arg name="z" value="0"/>
<arg name="R" value="0"/>
<arg name="P" value="0"/>
<arg name="Y" value="0"/>
<arg name="vehicle" value="$(arg vehicle)"/>
<arg name="mavlink_udp_port" value="14561"/>
<arg name="mavlink_tcp_port" value="4561"/>
<arg name="ID" value="$(arg ID)"/>
</include>
<!-- MAVROS -->
<include file="$(find mavros)/launch/px4.launch">
<arg name="fcu_url" value="$(arg fcu_url)"/>
<arg name="gcs_url" value=""/>
<arg name="tgt_system" value="$(eval 1 + arg('ID'))"/>
<arg name="tgt_component" value="1"/>
</include>
</group>
<!-- UAV2 -->
<group ns="uav2">
<!-- MAVROS and vehicle configs -->
<arg name="ID" value="2"/>
<arg name="fcu_url" default="udp://:14542@localhost:14582"/>
<!-- PX4 SITL and vehicle spawn -->
<include file="$(find px4)/launch/single_vehicle_spawn_sdf.launch">
<arg name="x" value="0"/>
<arg name="y" value="1"/>
<arg name="z" value="0"/>
<arg name="R" value="0"/>
<arg name="P" value="0"/>
<arg name="Y" value="0"/>
<arg name="vehicle" value="$(arg vehicle)"/>
<arg name="mavlink_udp_port" value="14562"/>
<arg name="mavlink_tcp_port" value="4562"/>
<arg name="ID" value="$(arg ID)"/>
</include>
<!-- MAVROS -->
<include file="$(find mavros)/launch/px4.launch">
<arg name="fcu_url" value="$(arg fcu_url)"/>
<arg name="gcs_url" value=""/>
<arg name="tgt_system" value="$(eval 1 + arg('ID'))"/>
<arg name="tgt_component" value="1"/>
</include>
</group>
</launch>
<!-- to add more UAVs (up to 10):
Increase the id
Change the name space
Set the FCU to default="udp://:14540+id@localhost:14550+id"
Set the malink_udp_port to 14560+id) -->
-13
View File
@@ -1,13 +0,0 @@
<launch>
<!-- Test mavros posix sitl publishes pose at 30 Hz -->
<include file="$(find px4)/launch/mavros_posix_sitl.launch">
<arg name="gui" value="false"/>
<arg name="interactive" value="false"/>
<arg name="verbose" value="true"/>
</include>
<param name="pub_test/topic" value="/mavros/local_position/pose"/>
<param name="pub_test/hz" value="30.0"/>
<param name="pub_test/hzerror" value="1.0"/>
<param name="pub_test/test_duration" value="10.0"/>
<test test-name="pub_test" pkg="rostest" type="hztest" name="pub_test"/>
</launch>
-18
View File
@@ -1,18 +0,0 @@
<?xml version="1.0"?>
<launch>
<!-- Posix SITL PX4 launch script -->
<!-- Launches Only PX4 SITL. This can be used by external projects -->
<!-- PX4 config arguments -->
<arg name="est" default="ekf2"/>
<arg name="vehicle" default="iris"/>
<arg name="ID" default="0"/>
<arg name="interactive" default="true"/>
<env name="PX4_SIM_MODEL" value="$(arg vehicle)" />
<env name="PX4_ESTIMATOR" value="$(arg est)" />
<arg unless="$(arg interactive)" name="px4_command_arg1" value="-d"/>
<arg if="$(arg interactive)" name="px4_command_arg1" value=""/>
<node name="sitl_$(arg ID)" pkg="px4" type="px4" output="screen" args="$(find px4)/build/px4_sitl_default/etc -s etc/init.d-posix/rcS -i $(arg ID) $(arg px4_command_arg1)">
</node>
</launch>
-36
View File
@@ -1,36 +0,0 @@
<?xml version="1.0"?>
<launch>
<!-- Posix SITL environment launch script -->
<!-- launchs PX4 SITL and spawns vehicle -->
<!-- vehicle pose -->
<arg name="x" default="0"/>
<arg name="y" default="0"/>
<arg name="z" default="0"/>
<arg name="R" default="0"/>
<arg name="P" default="0"/>
<arg name="Y" default="0"/>
<!-- vehicle model and config -->
<arg name="est" default="ekf2"/>
<arg name="vehicle" default="iris"/>
<arg name="ID" default="1"/>
<env name="PX4_SIM_MODEL" value="$(arg vehicle)" />
<env name="PX4_ESTIMATOR" value="$(arg est)" />
<arg name="mavlink_udp_port" default="14560"/>
<arg name="mavlink_tcp_port" default="4560"/>
<arg name="gst_udp_port" default="5600"/>
<arg name="video_uri" default="5600"/>
<arg name="mavlink_cam_udp_port" default="14530"/>
<arg name="mavlink_id" value="$(eval 1 + arg('ID'))" />
<!-- PX4 configs -->
<arg name="interactive" default="true"/>
<!-- generate sdf vehicle model -->
<arg name="cmd" default="$(find mavlink_sitl_gazebo)/scripts/jinja_gen.py --stdout --mavlink_id=$(arg mavlink_id) --mavlink_udp_port=$(arg mavlink_udp_port) --mavlink_tcp_port=$(arg mavlink_tcp_port) --gst_udp_port=$(arg gst_udp_port) --video_uri=$(arg video_uri) --mavlink_cam_udp_port=$(arg mavlink_cam_udp_port) $(find mavlink_sitl_gazebo)/models/$(arg vehicle)/$(arg vehicle).sdf.jinja $(find mavlink_sitl_gazebo)"/>
<param command="$(arg cmd)" name="sdf_$(arg vehicle)$(arg ID)"/>
<!-- PX4 SITL -->
<arg unless="$(arg interactive)" name="px4_command_arg1" value=""/>
<arg if="$(arg interactive)" name="px4_command_arg1" value="-d"/>
<node name="sitl_$(arg ID)" pkg="px4" type="px4" output="screen" args="$(find px4)/build/px4_sitl_default/etc -s etc/init.d-posix/rcS -i $(arg ID) -w sitl_$(arg vehicle)_$(arg ID) $(arg px4_command_arg1)">
</node>
<!-- spawn vehicle -->
<node name="$(anon vehicle_spawn)" pkg="gazebo_ros" type="spawn_model" output="screen" args="-sdf -param sdf_$(arg vehicle)$(arg ID) -model $(arg vehicle)$(arg ID) -x $(arg x) -y $(arg y) -z $(arg z) -R $(arg R) -P $(arg P) -Y $(arg Y)"/>
</launch>
-32
View File
@@ -1,32 +0,0 @@
<?xml version="1.0"?>
<launch>
<!-- Posix SITL environment launch script -->
<!-- launchs PX4 SITL and spawns vehicle -->
<!-- vehicle pose -->
<arg name="x" default="0"/>
<arg name="y" default="0"/>
<arg name="z" default="0"/>
<arg name="R" default="0"/>
<arg name="P" default="0"/>
<arg name="Y" default="0"/>
<!-- vehcile model and config -->
<arg name="est" default="ekf2"/>
<arg name="vehicle" default="plane"/>
<arg name="ID" default="1"/>
<env name="PX4_SIM_MODEL" value="$(arg vehicle)" />
<env name="PX4_ESTIMATOR" value="$(arg est)" />
<arg name="mavlink_udp_port" default="14560"/>
<arg name="mavlink_tcp_port" default="4560"/>
<!-- PX4 configs -->
<arg name="interactive" default="true"/>
<!-- generate sdf vehicle model -->
<arg name="cmd" default="xmlstarlet ed -d '//plugin[@name=&quot;mavlink_interface&quot;]/mavlink_tcp_port' -s '//plugin[@name=&quot;mavlink_interface&quot;]' -t elem -n mavlink_tcp_port -v $(arg mavlink_tcp_port) $(find px4)/Tools/sitl_gazebo/models/$(arg vehicle)/$(arg vehicle).sdf"/>
<param command="$(arg cmd)" name="model_description"/>
<!-- PX4 SITL -->
<arg unless="$(arg interactive)" name="px4_command_arg1" value=""/>
<arg if="$(arg interactive)" name="px4_command_arg1" value="-d"/>
<node name="sitl_$(arg ID)" pkg="px4" type="px4" output="screen" args="$(find px4)/build/px4_sitl_default/etc -s etc/init.d-posix/rcS -i $(arg ID) -w sitl_$(arg vehicle)_$(arg ID) $(arg px4_command_arg1)">
</node>
<!-- spawn vehicle -->
<node name="$(arg vehicle)_$(arg ID)_spawn" output="screen" pkg="gazebo_ros" type="spawn_model" args="-sdf -param model_description -model $(arg vehicle)_$(arg ID) -x $(arg x) -y $(arg y) -z $(arg z) -R $(arg R) -P $(arg P) -Y $(arg Y)"/>
</launch>
@@ -20,6 +20,3 @@ uint8 GROUP_INDEX_PAYLOAD = 6
uint64 timestamp_sample # the timestamp the data this control response is based on was sampled uint64 timestamp_sample # the timestamp the data this control response is based on was sampled
float32[8] control float32[8] control
# TOPICS actuator_controls actuator_controls_0 actuator_controls_1 actuator_controls_2 actuator_controls_3
# TOPICS actuator_controls_virtual_fw actuator_controls_virtual_mc
@@ -6,5 +6,3 @@ uint8 INDEX_YAW = 2
uint8 INDEX_THROTTLE = 3 uint8 INDEX_THROTTLE = 3
float32[4] control_power float32[4] control_power
# TOPICS actuator_controls_status actuator_controls_status_0 actuator_controls_status_1
+181 -240
View File
@@ -1,6 +1,6 @@
############################################################################ ############################################################################
# #
# Copyright (c) 2016 PX4 Development Team. All rights reserved. # Copyright (c) 2016-2022 PX4 Development Team. All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions # modification, are permitted provided that the following conditions
@@ -37,212 +37,178 @@ cmake_policy(SET CMP0057 NEW)
include(px4_list_make_absolute) include(px4_list_make_absolute)
set(msg_files set(msg_files
action_request.msg ActionRequest.msg
actuator_armed.msg ActuatorArmed.msg
actuator_controls.msg ActuatorControls.msg
actuator_controls_status.msg ActuatorControlsStatus.msg
actuator_motors.msg ActuatorMotors.msg
actuator_outputs.msg ActuatorOutputs.msg
actuator_servos.msg ActuatorServos.msg
actuator_servos_trim.msg ActuatorServosTrim.msg
actuator_test.msg ActuatorTest.msg
adc_report.msg AdcReport.msg
airspeed.msg Airspeed.msg
airspeed_validated.msg AirspeedValidated.msg
airspeed_wind.msg AirspeedWind.msg
autotune_attitude_control_status.msg AutotuneAttitudeControlStatus.msg
battery_status.msg BatteryStatus.msg
camera_capture.msg CameraCapture.msg
camera_status.msg CameraStatus.msg
camera_trigger.msg CameraTrigger.msg
cellular_status.msg CellularStatus.msg
collision_constraints.msg CollisionConstraints.msg
collision_report.msg CollisionReport.msg
commander_state.msg CommanderState.msg
control_allocator_status.msg ControlAllocatorStatus.msg
cpuload.msg Cpuload.msg
differential_pressure.msg DebugArray.msg
distance_sensor.msg DebugKeyValue.msg
ekf2_timestamps.msg DebugValue.msg
ekf_gps_drift.msg DebugVect.msg
esc_report.msg DifferentialPressure.msg
esc_status.msg DistanceSensor.msg
estimator_baro_bias.msg Ekf2Timestamps.msg
estimator_event_flags.msg EkfGpsDrift.msg
estimator_innovations.msg EscReport.msg
estimator_optical_flow_vel.msg EscStatus.msg
estimator_selector_status.msg EstimatorBaroBias.msg
estimator_sensor_bias.msg EstimatorEventFlags.msg
estimator_states.msg EstimatorInnovations.msg
estimator_status.msg EstimatorOpticalFlowVel.msg
estimator_status_flags.msg EstimatorSelectorStatus.msg
event.msg EstimatorSensorBias.msg
follow_target.msg EstimatorStates.msg
failure_detector_status.msg EstimatorStatus.msg
generator_status.msg EstimatorStatusFlags.msg
geofence_result.msg Event.msg
gimbal_device_attitude_status.msg FailureDetectorStatus.msg
gimbal_device_information.msg FollowTarget.msg
gimbal_device_set_attitude.msg GeneratorStatus.msg
gimbal_manager_information.msg GeofenceResult.msg
gimbal_manager_set_attitude.msg GimbalDeviceAttitudeStatus.msg
gimbal_manager_set_manual_control.msg GimbalDeviceInformation.msg
gimbal_manager_status.msg GimbalDeviceSetAttitude.msg
gps_dump.msg GimbalManagerInformation.msg
gps_inject_data.msg GimbalManagerSetAttitude.msg
heater_status.msg GimbalManagerSetManualControl.msg
home_position.msg GimbalManagerStatus.msg
hover_thrust_estimate.msg GpsDump.msg
internal_combustion_engine_status.msg GpsInjectData.msg
input_rc.msg HeaterStatus.msg
iridiumsbd_status.msg HomePosition.msg
irlock_report.msg HoverThrustEstimate.msg
landing_gear.msg InputRc.msg
landing_target_innovations.msg InternalCombustionEngineStatus.msg
landing_target_pose.msg IridiumsbdStatus.msg
led_control.msg IrlockReport.msg
log_message.msg LandingGear.msg
logger_status.msg LandingTargetInnovations.msg
mag_worker_data.msg LandingTargetPose.msg
magnetometer_bias_estimate.msg LedControl.msg
manual_control_setpoint.msg LoggerStatus.msg
manual_control_switches.msg LogMessage.msg
mavlink_log.msg MagnetometerBiasEstimate.msg
mission.msg MagWorkerData.msg
mission_result.msg ManualControlSetpoint.msg
mount_orientation.msg ManualControlSwitches.msg
navigator_mission_item.msg MavlinkLog.msg
npfg_status.msg Mission.msg
obstacle_distance.msg MissionResult.msg
offboard_control_mode.msg MountOrientation.msg
onboard_computer_status.msg NavigatorMissionItem.msg
optical_flow.msg NpfgStatus.msg
orbit_status.msg ObstacleDistance.msg
parameter_update.msg OffboardControlMode.msg
ping.msg OnboardComputerStatus.msg
pps_capture.msg OpticalFlow.msg
position_controller_landing_status.msg OrbitStatus.msg
position_controller_status.msg OrbTest.msg
position_setpoint.msg OrbTestLarge.msg
position_setpoint_triplet.msg OrbTestMedium.msg
power_button_state.msg ParameterUpdate.msg
power_monitor.msg Ping.msg
pwm_input.msg PpsCapture.msg
px4io_status.msg PositionControllerLandingStatus.msg
radio_status.msg PositionControllerStatus.msg
rate_ctrl_status.msg PositionSetpoint.msg
rc_channels.msg PositionSetpointTriplet.msg
rc_parameter_map.msg PowerButtonState.msg
rpm.msg PowerMonitor.msg
rtl_time_estimate.msg PwmInput.msg
safety.msg Px4ioStatus.msg
satellite_info.msg RadioStatus.msg
sensor_accel.msg RateCtrlStatus.msg
sensor_accel_fifo.msg RcChannels.msg
sensor_baro.msg RcParameterMap.msg
sensor_combined.msg Rpm.msg
sensor_correction.msg RtlTimeEstimate.msg
sensor_gps.msg Safety.msg
sensor_gyro.msg SatelliteInfo.msg
sensor_gyro_fft.msg SensorAccel.msg
sensor_gyro_fifo.msg SensorAccelFifo.msg
sensor_hygrometer.msg SensorBaro.msg
sensor_mag.msg SensorCombined.msg
sensor_preflight_mag.msg SensorCorrection.msg
sensor_selection.msg SensorGps.msg
sensors_status_imu.msg SensorGyro.msg
system_power.msg SensorGyroFft.msg
takeoff_status.msg SensorGyroFifo.msg
task_stack_info.msg SensorHygrometer.msg
tecs_status.msg SensorMag.msg
telemetry_status.msg SensorPreflightMag.msg
test_motor.msg SensorSelection.msg
timesync.msg SensorsStatusImu.msg
timesync_status.msg SystemPower.msg
trajectory_bezier.msg TakeoffStatus.msg
trajectory_waypoint.msg TaskStackInfo.msg
transponder_report.msg TecsStatus.msg
tune_control.msg TelemetryStatus.msg
uavcan_parameter_request.msg TestMotor.msg
uavcan_parameter_value.msg Timesync.msg
ulog_stream.msg TimesyncStatus.msg
ulog_stream_ack.msg TrajectoryBezier.msg
vehicle_acceleration.msg TrajectoryWaypoint.msg
vehicle_air_data.msg TransponderReport.msg
vehicle_angular_acceleration.msg TuneControl.msg
vehicle_angular_acceleration_setpoint.msg UavcanParameterRequest.msg
vehicle_angular_velocity.msg UavcanParameterValue.msg
vehicle_attitude.msg UlogStream.msg
vehicle_attitude_setpoint.msg UlogStreamAck.msg
vehicle_command.msg VehicleAcceleration.msg
vehicle_command_ack.msg VehicleAirData.msg
vehicle_constraints.msg VehicleAngularAcceleration.msg
vehicle_control_mode.msg VehicleAngularAccelerationSetpoint.msg
vehicle_global_position.msg VehicleAngularVelocity.msg
vehicle_gps_position.msg VehicleAttitude.msg
vehicle_imu.msg VehicleAttitudeSetpoint.msg
vehicle_imu_status.msg VehicleCommand.msg
vehicle_land_detected.msg VehicleCommandAck.msg
vehicle_local_position.msg VehicleConstraints.msg
vehicle_local_position_setpoint.msg VehicleControlMode.msg
vehicle_magnetometer.msg VehicleGlobalPosition.msg
vehicle_odometry.msg VehicleGpsPosition.msg
vehicle_rates_setpoint.msg VehicleImu.msg
vehicle_roi.msg VehicleImuStatus.msg
vehicle_status.msg VehicleLandDetected.msg
vehicle_status_flags.msg VehicleLocalPosition.msg
vehicle_thrust_setpoint.msg VehicleLocalPositionSetpoint.msg
vehicle_torque_setpoint.msg VehicleMagnetometer.msg
vehicle_trajectory_bezier.msg VehicleOdometry.msg
vehicle_trajectory_waypoint.msg VehicleRatesSetpoint.msg
vtol_vehicle_status.msg VehicleRoi.msg
wheel_encoders.msg VehicleStatus.msg
wind.msg VehicleStatusFlags.msg
yaw_estimator_status.msg VehicleThrustSetpoint.msg
VehicleTorqueSetpoint.msg
VehicleTrajectoryBezier.msg
VehicleTrajectoryWaypoint.msg
VtolVehicleStatus.msg
WheelEncoders.msg
Wind.msg
YawEstimatorStatus.msg
) )
if(NOT px4_constrained_flash_build)
list(APPEND msg_files
debug_array.msg
debug_key_value.msg
debug_value.msg
debug_vect.msg
)
endif()
if(PX4_TESTING)
list(APPEND msg_files
orb_test.msg
orb_test_large.msg
orb_test_medium.msg
)
endif()
list(SORT msg_files) list(SORT msg_files)
set(deprecated_msgs
ekf2_innovations.msg # 2019-11-22, Updated estimator interface and logging; replaced by 'estimator_innovations'.
)
foreach(msg IN LISTS deprecated_msgs)
if(msg IN_LIST msg_files)
get_filename_component(msg_we ${msg} NAME_WE)
list(APPEND invalid_msgs ${msg_we})
endif()
endforeach()
if(invalid_msgs)
list(LENGTH invalid_msgs invalid_msgs_size)
if(${invalid_msgs_size} GREATER 1)
foreach(msg IN LISTS invalid_msgs)
string(CONCAT invalid_msgs_cs ${invalid_msgs_cs} "'${msg}', ")
endforeach()
STRING(REGEX REPLACE ", +$" "" invalid_msgs_cs ${invalid_msgs_cs})
message(FATAL_ERROR "${invalid_msgs_cs} are listed as deprecated. Please use different names for the messages.")
else()
message(FATAL_ERROR "'${invalid_msgs}' is listed as deprecated. Please use a different name for the message.")
endif()
endif()
px4_list_make_absolute(msg_files ${CMAKE_CURRENT_SOURCE_DIR} ${msg_files}) px4_list_make_absolute(msg_files ${CMAKE_CURRENT_SOURCE_DIR} ${msg_files})
if(NOT EXTERNAL_MODULES_LOCATION STREQUAL "") if(NOT EXTERNAL_MODULES_LOCATION STREQUAL "")
@@ -257,40 +223,40 @@ if(NOT EXTERNAL_MODULES_LOCATION STREQUAL "")
endif() endif()
endif() endif()
# set parent scope msg_files for other modules to consume (eg topic_listener)
set(msg_files ${msg_files} PARENT_SCOPE)
# headers # headers
set(msg_out_path ${PX4_BINARY_DIR}/uORB/topics) set(msg_out_path ${PX4_BINARY_DIR}/uORB/topics)
set(msg_source_out_path ${CMAKE_CURRENT_BINARY_DIR}/topics_sources) set(msg_source_out_path ${CMAKE_CURRENT_BINARY_DIR}/topics_sources)
set(uorb_headers ${msg_out_path}/uORBTopics.hpp) set(uorb_headers)
set(uorb_sources ${msg_source_out_path}/uORBTopics.cpp)
foreach(msg_file ${msg_files}) foreach(msg_file ${msg_files})
get_filename_component(msg ${msg_file} NAME_WE) get_filename_component(msg ${msg_file} NAME_WE)
# Pascal case to snake case (MsgFile -> msg_file)
string(REGEX REPLACE "(.)([A-Z][a-z]+)" "\\1_\\2" msg "${msg}")
string(REGEX REPLACE "([a-z0-9])([A-Z])" "\\1_\\2" msg "${msg}")
string(TOLOWER "${msg}" msg)
list(APPEND uorb_headers ${msg_out_path}/${msg}.h) list(APPEND uorb_headers ${msg_out_path}/${msg}.h)
list(APPEND uorb_sources ${msg_source_out_path}/${msg}.cpp)
endforeach() endforeach()
if (px4_constrained_flash_build) if(px4_constrained_flash_build)
set(added_arguments --constrained-flash) set(added_arguments --constrained-flash)
endif() endif()
# set parent scope msg_files for other modules to consume (eg topic_listener)
set(msg_files ${msg_files} PARENT_SCOPE)
# Generate uORB headers # Generate uORB headers
add_custom_command(OUTPUT ${uorb_headers} add_custom_command(OUTPUT ${uorb_headers}
COMMAND ${PYTHON_EXECUTABLE} tools/px_generate_uorb_topic_files.py COMMAND ${PYTHON_EXECUTABLE} tools/px_generate_uorb_topic_files.py
--headers
-f ${msg_files} -f ${msg_files}
-i ${CMAKE_CURRENT_SOURCE_DIR} -i ${CMAKE_CURRENT_SOURCE_DIR}
-o ${msg_out_path} -o ${msg_out_path}
-e templates/uorb -e templates/uorb
-t ${CMAKE_CURRENT_BINARY_DIR}/tmp/headers
-q
${added_arguments} ${added_arguments}
DEPENDS DEPENDS
${msg_files} ${msg_files}
templates/uorb/msg.h.em templates/uorb/msg.h.em
templates/uorb/uORBTopics.hpp.em
tools/px_generate_uorb_topic_files.py tools/px_generate_uorb_topic_files.py
tools/px_generate_uorb_topic_helper.py tools/px_generate_uorb_topic_helper.py
COMMENT "Generating uORB topic headers" COMMENT "Generating uORB topic headers"
@@ -298,28 +264,3 @@ add_custom_command(OUTPUT ${uorb_headers}
VERBATIM VERBATIM
) )
add_custom_target(uorb_headers DEPENDS ${uorb_headers}) add_custom_target(uorb_headers DEPENDS ${uorb_headers})
# Generate uORB sources
add_custom_command(OUTPUT ${uorb_sources}
COMMAND ${PYTHON_EXECUTABLE} tools/px_generate_uorb_topic_files.py
--sources
-f ${msg_files}
-i ${CMAKE_CURRENT_SOURCE_DIR}
-o ${msg_source_out_path}
-e templates/uorb
-t ${CMAKE_CURRENT_BINARY_DIR}/tmp/sources
-q
${added_arguments}
DEPENDS
${msg_files}
templates/uorb/msg.cpp.em
templates/uorb/uORBTopics.cpp.em
tools/px_generate_uorb_topic_files.py
tools/px_generate_uorb_topic_helper.py
COMMENT "Generating uORB topic sources"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM
)
add_library(uorb_msgs ${uorb_sources})
add_dependencies(uorb_msgs prebuild_targets uorb_headers)
@@ -5,5 +5,3 @@ uint32 seq # Image sequence number
bool feedback # Trigger feedback from camera bool feedback # Trigger feedback from camera
uint32 ORB_QUEUE_LENGTH = 2 uint32 ORB_QUEUE_LENGTH = 2
# TOPICS camera_trigger
View File
+1 -1
View File
@@ -25,4 +25,4 @@ uint8 esc_online_flags # Bitmask indicating which ESC is online/offline
uint8 esc_armed_flags # Bitmask indicating which ESC is armed. For ESC's where the arming state is not known (returned by the ESC), the arming bits should always be set. uint8 esc_armed_flags # Bitmask indicating which ESC is armed. For ESC's where the arming state is not known (returned by the ESC), the arming bits should always be set.
esc_report[8] esc px4/EscReport[8] esc
@@ -34,5 +34,3 @@ float32 hagl # height of ground innovation (m) and innovation variance (m**2)
# The innovation test ratios are scalar values. In case the field is a vector, # The innovation test ratios are scalar values. In case the field is a vector,
# the test ratio will be put in the first component of the vector. # the test ratio will be put in the first component of the vector.
# TOPICS estimator_innovations estimator_innovation_variances estimator_innovation_test_ratios
View File
@@ -52,5 +52,3 @@ float32 aux5
float32 aux6 float32 aux6
bool sticks_moving bool sticks_moving
# TOPICS manual_control_setpoint manual_control_input
View File

Some files were not shown because too many files have changed in this diff Show More