From c3e70b03aa0690715d5c0bc62b7e94ad60fb8dff Mon Sep 17 00:00:00 2001 From: Eric Katzfey <53063038+katzfey@users.noreply.github.com> Date: Thu, 22 Dec 2022 12:44:19 -0800 Subject: [PATCH] Add more to Voxl2 build and fix associated build errors (#20821) - Do not pull in PWM parameters when DISABLE_PARAMS_MODULE_SCOPING is TRUE since VOXL2 has no PWM nor any of the required timer_config files that go along with that - Replace non-standard M_PI constants with PX4 defined M_PI_F constants - Include missing header file for function hrt_absolute_time declaration - Add new PX4_SOC_ARCH_ID for the VOXL2 board --- boards/modalai/voxl2-slpi/default.px4board | 7 +++++++ boards/modalai/voxl2-slpi/src/CMakeLists.txt | 5 +++++ boards/modalai/voxl2/default.px4board | 7 +++++++ boards/modalai/voxl2/src/CMakeLists.txt | 6 ++++++ boards/modalai/voxl2/src/board_config.h | 3 +++ .../common/include/px4_platform_common/board_common.h | 2 ++ src/lib/controllib/BlockHighPass.cpp | 2 +- src/lib/controllib/BlockLowPass.cpp | 2 +- src/lib/controllib/BlockLowPassVector.hpp | 2 +- src/lib/parameters/CMakeLists.txt | 9 ++++++++- src/modules/sensors/data_validator/DataValidator.cpp | 1 + 11 files changed, 42 insertions(+), 4 deletions(-) diff --git a/boards/modalai/voxl2-slpi/default.px4board b/boards/modalai/voxl2-slpi/default.px4board index d27d6a6f20..a84f9c7d95 100644 --- a/boards/modalai/voxl2-slpi/default.px4board +++ b/boards/modalai/voxl2-slpi/default.px4board @@ -6,3 +6,10 @@ CONFIG_ORB_COMMUNICATOR=y CONFIG_SYSTEMCMDS_PARAM=y CONFIG_DRIVERS_QSHELL_QURT=y CONFIG_DRIVERS_ACTUATORS_MODALAI_ESC=y +CONFIG_MODULES_SENSORS=y +CONFIG_MODULES_EKF2=y +CONFIG_MODULES_MC_POS_CONTROL=y +CONFIG_MODULES_MC_ATT_CONTROL=y +CONFIG_MODULES_MC_RATE_CONTROL=y +CONFIG_MODULES_MC_HOVER_THRUST_ESTIMATOR=y +CONFIG_MODULES_LAND_DETECTOR=y diff --git a/boards/modalai/voxl2-slpi/src/CMakeLists.txt b/boards/modalai/voxl2-slpi/src/CMakeLists.txt index c72ebefdcb..31a10426fb 100644 --- a/boards/modalai/voxl2-slpi/src/CMakeLists.txt +++ b/boards/modalai/voxl2-slpi/src/CMakeLists.txt @@ -31,6 +31,11 @@ # ############################################################################ +# Need to make sure that the DSP processor on VOXL2 +# knows about all parameters since some modules need parameters +# from other modules that are not running on the DSP. +set(DISABLE_PARAMS_MODULE_SCOPING TRUE PARENT_SCOPE) + add_library(drivers_board board_config.h init.c diff --git a/boards/modalai/voxl2/default.px4board b/boards/modalai/voxl2/default.px4board index 464feed956..e8bdd22138 100644 --- a/boards/modalai/voxl2/default.px4board +++ b/boards/modalai/voxl2/default.px4board @@ -9,3 +9,10 @@ CONFIG_SYSTEMCMDS_PARAM=y CONFIG_DRIVERS_QSHELL_POSIX=y CONFIG_SYSTEMCMDS_TOPIC_LISTENER=y CONFIG_SYSTEMCMDS_BSONDUMP=y +CONFIG_MODULES_LOGGER=y +CONFIG_MODULES_RC_UPDATE=y +CONFIG_MODULES_DATAMAN=y +CONFIG_MODULES_NAVIGATOR=y +CONFIG_MODULES_COMMANDER=y +CONFIG_MODULES_FLIGHT_MODE_MANAGER=y +CONFIG_MODULES_MAVLINK=y diff --git a/boards/modalai/voxl2/src/CMakeLists.txt b/boards/modalai/voxl2/src/CMakeLists.txt index b2ef3aacd2..f23ed05ec1 100644 --- a/boards/modalai/voxl2/src/CMakeLists.txt +++ b/boards/modalai/voxl2/src/CMakeLists.txt @@ -31,6 +31,12 @@ # ############################################################################ +# Need to make sure that the Linux processor on VOXL2 +# knows about all parameters since it is acting as the +# parameter server for other processors that may define +# parameters that it doesn't normally know about. +set(DISABLE_PARAMS_MODULE_SCOPING TRUE PARENT_SCOPE) + add_library(drivers_board board_config.h init.c diff --git a/boards/modalai/voxl2/src/board_config.h b/boards/modalai/voxl2/src/board_config.h index 4f87f443eb..c44de17796 100644 --- a/boards/modalai/voxl2/src/board_config.h +++ b/boards/modalai/voxl2/src/board_config.h @@ -47,3 +47,6 @@ #include #include + +#define BOARD_OVERRIDE_UUID "MODALAIVOXL20000" // must be of length 16 +#define PX4_SOC_ARCH_ID PX4_SOC_ARCH_ID_VOXL2 diff --git a/platforms/common/include/px4_platform_common/board_common.h b/platforms/common/include/px4_platform_common/board_common.h index a7c59df0b2..832b0dbd6a 100644 --- a/platforms/common/include/px4_platform_common/board_common.h +++ b/platforms/common/include/px4_platform_common/board_common.h @@ -351,6 +351,8 @@ typedef enum PX4_SOC_ARCH_ID_t { PX4_SOC_ARCH_ID_BBBLUE = 0x1008, + PX4_SOC_ARCH_ID_VOXL2 = 0x100A, + } PX4_SOC_ARCH_ID_t; diff --git a/src/lib/controllib/BlockHighPass.cpp b/src/lib/controllib/BlockHighPass.cpp index 9979996c3c..d80624181e 100644 --- a/src/lib/controllib/BlockHighPass.cpp +++ b/src/lib/controllib/BlockHighPass.cpp @@ -47,7 +47,7 @@ namespace control float BlockHighPass::update(float input) { - float b = 2 * float(M_PI) * getFCut() * getDt(); + float b = 2 * M_PI_F * getFCut() * getDt(); float a = 1 / (1 + b); setY(a * (getY() + input - getU())); setU(input); diff --git a/src/lib/controllib/BlockLowPass.cpp b/src/lib/controllib/BlockLowPass.cpp index b3551289c1..f2883d9569 100644 --- a/src/lib/controllib/BlockLowPass.cpp +++ b/src/lib/controllib/BlockLowPass.cpp @@ -51,7 +51,7 @@ float BlockLowPass::update(float input) setState(input); } - float b = 2 * float(M_PI) * getFCut() * getDt(); + float b = 2 * M_PI_F * getFCut() * getDt(); float a = b / (1 + b); setState(a * input + (1 - a)*getState()); return getState(); diff --git a/src/lib/controllib/BlockLowPassVector.hpp b/src/lib/controllib/BlockLowPassVector.hpp index a591fe5d1f..b7042faf00 100644 --- a/src/lib/controllib/BlockLowPassVector.hpp +++ b/src/lib/controllib/BlockLowPassVector.hpp @@ -79,7 +79,7 @@ public: } } - float b = 2 * float(M_PI) * getFCut() * getDt(); + float b = 2 * M_PI_F * getFCut() * getDt(); float a = b / (1 + b); setState(input * a + getState() * (1 - a)); return getState(); diff --git a/src/lib/parameters/CMakeLists.txt b/src/lib/parameters/CMakeLists.txt index 908776bd41..7e9ce681e5 100644 --- a/src/lib/parameters/CMakeLists.txt +++ b/src/lib/parameters/CMakeLists.txt @@ -57,7 +57,14 @@ if(DISABLE_PARAMS_MODULE_SCOPING) ${PX4_SOURCE_DIR}/src/*.yaml ) foreach(file_path ${yaml_files}) - list(APPEND module_config_files "${file_path}") + # VOXL2 doesn't support PWM and so it has no timer configurations + # that are expected when dealing with certain pwm modules. This will + # allow those timer configurations to be skipped. + if ((${PX4_BOARD_NAME} MATCHES "MODALAI_VOXL2") AND (file_path MATCHES pwm_out)) + message(STATUS "Skipping pwm file path ${file_path} for VOXL2") + else() + list(APPEND module_config_files "${file_path}") + endif() endforeach() list(REMOVE_DUPLICATES module_config_files) diff --git a/src/modules/sensors/data_validator/DataValidator.cpp b/src/modules/sensors/data_validator/DataValidator.cpp index 69fb822cde..75b2f88e88 100644 --- a/src/modules/sensors/data_validator/DataValidator.cpp +++ b/src/modules/sensors/data_validator/DataValidator.cpp @@ -42,6 +42,7 @@ #include "DataValidator.hpp" #include +#include void DataValidator::put(uint64_t timestamp, float val, uint32_t error_count_in, uint8_t priority_in) {