From 3c6f67fc7b76782d8446ee51f2a2f31f2273792e Mon Sep 17 00:00:00 2001 From: latercomer Date: Sat, 28 Sep 2024 13:10:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4param=E5=92=8Cworkq=E7=9A=84?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E7=A9=BA=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: latercomer --- apps/airframe/airframe.cpp | 2 +- .../HealthAndArmingChecks/Common.hpp | 28 +- .../checks/accelerometerCheck.hpp | 2 +- .../checks/airspeedCheck.hpp | 2 +- .../checks/baroCheck.hpp | 2 +- .../checks/batteryCheck.hpp | 2 +- .../checks/cpuResourceCheck.hpp | 2 +- .../checks/distanceSensorChecks.hpp | 2 +- .../HealthAndArmingChecks/checks/escCheck.hpp | 2 +- .../checks/estimatorCheck.hpp | 2 +- .../checks/flightTimeCheck.hpp | 2 +- .../checks/magnetometerCheck.hpp | 2 +- .../checks/modeCheck.hpp | 2 +- .../checks/offboardCheck.hpp | 2 +- .../checks/parachuteCheck.hpp | 2 +- .../checks/powerCheck.hpp | 2 +- .../checks/rcAndDataLinkCheck.hpp | 2 +- .../checks/rcCalibrationCheck.hpp | 2 +- .../checks/sdcardCheck.hpp | 6 +- .../checks/systemCheck.hpp | 2 +- .../checks/vtolCheck.hpp | 2 +- .../checks/windCheck.hpp | 2 +- .../controller/commander/failsafe/framework.h | 45 +- .../failure_detector/FailureDetector.hpp | 2 +- ...ontrolAllocationSequentialDesaturation.hpp | 3 +- .../control_allocator/ControlAllocator.hpp | 4 +- .../TargetEstimator.hpp | 3 +- .../tasks/FlightTask/FlightTask.hpp | 3 +- .../tasks/Utility/StickAccelerationXY.hpp | 2 +- .../tasks/Utility/StickTiltXY.hpp | 2 +- .../tasks/Utility/StickYaw.hpp | 2 +- .../tasks/Utility/Sticks.hpp | 2 +- .../FixedwingAttitudeControl.hpp | 3 +- .../fw_autotune_attitude_control.hpp | 3 +- .../FixedwingPositionControl.hpp | 3 +- .../launchdetection/LaunchDetector.h | 3 +- .../runway_takeoff/RunwayTakeoff.h | 3 +- .../fw_rate_control/FixedwingRateControl.hpp | 4 +- apps/controller/land_detector/LandDetector.h | 3 +- .../manual_control/ManualControl.hpp | 3 +- .../mc_att_control/mc_att_control.hpp | 13 +- .../mc_autotune_attitude_control.hpp | 3 +- .../MulticopterHoverThrustEstimator.hpp | 3 +- .../MulticopterPositionControl.hpp | 4 +- .../MulticopterRateControl.cpp | 3 +- .../MulticopterRateControl.hpp | 5 +- .../MissionFeasibility/FeasibilityChecker.hpp | 2 +- apps/controller/navigator/geofence.h | 2 +- apps/controller/navigator/mission.h | 2 +- apps/controller/navigator/navigator.h | 2 +- apps/controller/navigator/precland.h | 2 +- apps/controller/navigator/rtl.h | 2 +- apps/controller/navigator/vtol_takeoff.h | 2 +- apps/controller/rc_update/rc_update.h | 3 +- apps/controller/vtol_att_control/tailsitter.h | 4 +- apps/controller/vtol_att_control/tiltrotor.h | 2 +- .../vtol_att_control/vtol_att_control_main.h | 5 +- apps/controller/vtol_att_control/vtol_type.h | 7 +- .../airspeed_selector_main.cpp | 2 +- .../attitude_estimator_q_main.cpp | 2 +- apps/estimator/ekf2_fake/ekf2_fake.hpp | 2 +- .../gyro_calibration/GyroCalibration.hpp | 2 +- .../BlockLocalPositionEstimator.hpp | 3 +- .../mag_bias_estimator/MagBiasEstimator.hpp | 3 +- .../VehicleAcceleration.hpp | 2 +- .../vehicle_air_data/VehicleAirData.hpp | 3 +- .../VehicleAngularVelocity.hpp | 3 +- .../VehicleGPSPosition.hpp | 3 +- .../sensors/vehicle_imu/VehicleIMU.hpp | 3 +- .../VehicleMagnetometer.hpp | 3 +- .../VehicleOpticalFlow.hpp | 3 +- apps/estimator/sensors/voted_sensors_update.h | 2 +- .../TemperatureCompensationModule.h | 3 +- .../avoidance/ObstacleAvoidance.hpp | 2 +- .../CollisionPrevention.hpp | 2 +- .../functions/FunctionProviderBase.hpp | 1 + .../controller/mixer_module/mixer_module.hpp | 3 +- .../controller/weather_vane/WeatherVane.hpp | 2 +- .../peripheral/notification/led/led.h | 2 +- apps/peripheral/actuator/pwm_out/PWMOut.cpp | 4 +- .../battery/battery_status/battery_status.cpp | 7 +- .../battery/esc_battery/EscBattery.cpp | 3 +- .../battery/esc_battery/EscBattery.hpp | 3 +- .../lights/rgbled_pwm/rgbled_pwm.cpp | 6 +- .../safety_button/SafetyButton.cpp | 2 +- .../safety_button/SafetyButton.hpp | 4 +- .../notification/tone_alarm/ToneAlarm.cpp | 2 +- .../notification/tone_alarm/ToneAlarm.h | 4 +- .../payload/camera_capture/camera_capture.cpp | 2 +- .../camera_feedback/CameraFeedback.cpp | 2 +- .../camera_feedback/CameraFeedback.hpp | 6 +- .../payload/camera_trigger/camera_trigger.cpp | 2 +- .../payload_deliverer/payload_deliverer.cpp | 2 +- .../sensor/gnss/pps_capture/PPSCapture.cpp | 2 +- .../battery_simulator/BatterySimulator.hpp | 3 +- apps/simulation/pwm_out_sim/PWMSim.hpp | 3 +- .../sensor_airspeed_sim/SensorAirspeedSim.hpp | 3 +- .../sensor_baro_sim/SensorBaroSim.hpp | 3 +- .../sensor_gps_sim/SensorGpsSim.hpp | 3 +- .../sensor_mag_sim/SensorMagSim.hpp | 3 +- apps/simulation/simulator_sih/sih.hpp | 2 +- apps/storage/logger/logger.h | 2 +- apps/storage/replay/Replay.cpp | 4 +- apps/storage/replay/Replay.hpp | 4 +- apps/storage/replay/ReplayEkf2.cpp | 4 +- apps/storage/replay/ReplayEkf2.hpp | 5 +- apps/telemetry/mavlink/mavlink_main.h | 2 +- apps/telemetry/mavlink/mavlink_receiver.h | 2 +- apps/telemetry/uavcan/uavcan_main.cpp | 2 +- apps/telemetry/uavcan/uavcan_main.hpp | 4 +- apps/utest/test_workq/workq_scheduled.cpp | 4 +- pkgs/include/nextpilot.h | 4 +- pkgs/load_mon/LoadMon.cpp | 2 +- pkgs/param/interface/param_autogen.hpp | 2 +- pkgs/param/interface/param_global_autogen.cpp | 20 +- pkgs/param/module_params.c | 9522 ++--- .../tools/templates/param_autogen.hpp.jinja | 2 +- pkgs/param/tools/toml/parameters.h.jinja | 4 +- pkgs/param/tools/toml/parameters_autogen.hpp | 54 +- pkgs/param/wrapper/param_wrap.hpp | 39 +- pkgs/param_v2/param.cpp | 2 +- pkgs/param_v2/param_autogen.hpp | 28676 ++++++++-------- pkgs/param_v2/param_wrap.hpp | 38 +- .../tools/templates/param_autogen.hpp.jinja | 2 +- pkgs/param_v2/tools/toml/parameters.h.jinja | 4 +- .../tools/toml/parameters_autogen.hpp | 4 +- pkgs/uORB/Subscription.hpp | 6 +- pkgs/workq/WorkItem.cpp | 12 +- pkgs/workq/WorkItem.hpp | 4 +- pkgs/workq/WorkItemScheduled.cpp | 4 +- pkgs/workq/WorkItemScheduled.hpp | 5 +- pkgs/workq/WorkItemSingleShot.cpp | 15 +- pkgs/workq/WorkItemSingleShot.hpp | 4 +- pkgs/workq/WorkQueue.cpp | 4 +- pkgs/workq/WorkQueue.hpp | 7 +- pkgs/workq/WorkQueueManager.cpp | 16 +- pkgs/workq/WorkQueueManager.hpp | 4 +- 137 files changed, 19461 insertions(+), 19383 deletions(-) diff --git a/apps/airframe/airframe.cpp b/apps/airframe/airframe.cpp index 681f4fc3d8..af4bb2e96d 100644 --- a/apps/airframe/airframe.cpp +++ b/apps/airframe/airframe.cpp @@ -63,7 +63,7 @@ static airframe_info_t __airframe_table__[100]; static uint16_t __airframe_count__ = UINT16_MAX; #endif -using namespace nextpilot::global_params; +using namespace nextpilot::param; bool airframe_section_init() { #if defined(_MSC_VER) diff --git a/apps/controller/commander/HealthAndArmingChecks/Common.hpp b/apps/controller/commander/HealthAndArmingChecks/Common.hpp index 712dc928c4..7e434f10f4 100644 --- a/apps/controller/commander/HealthAndArmingChecks/Common.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/Common.hpp @@ -27,11 +27,11 @@ // #define CONSOLE_PRINT_ARMING_CHECK_EVENT // for debugging, print updated events whenever they change #ifndef FRIEND_TEST // for gtest -#define FRIEND_TEST(a, b) +# define FRIEND_TEST(a, b) #endif using namespace time_literals; -using namespace nextpilot::global_params; +using namespace nextpilot::param; using namespace nextpilot; class HealthAndArmingChecks; @@ -85,6 +85,7 @@ class HealthComponentIndex { __attribute__((always_inline)) constexpr HealthComponentIndex(health_component_t component) : index(log2((uint64_t)component)) { } + const uint8_t index; }; @@ -132,9 +133,9 @@ class Report { error = {}; warning = {}; } + bool operator!=(const HealthResults &other) { - return is_present != other.is_present || error != other.error || - warning != other.warning; + return is_present != other.is_present || error != other.error || warning != other.warning; } }; @@ -149,7 +150,7 @@ class Report { NavModes can_arm; ///< whether arming is possible for each mode group (bitset) NavModes can_run; ///< whether switching into a certain mode is possible (while armed) - bool valid; ///< whether can_arm is valid, i.e. can be used + bool valid; ///< whether can_arm is valid, i.e. can be used void reset() { error = {}; @@ -158,15 +159,16 @@ class Report { can_run = (NavModes)-1; valid = false; } + bool operator!=(const ArmingCheckResults &other) { - return error != other.error || warning != other.warning || - can_arm != other.can_arm || can_run != other.can_run || valid != other.valid; + return error != other.error || warning != other.warning || can_arm != other.can_arm || can_run != other.can_run || valid != other.valid; } }; Report(failsafe_flags_s &failsafe_flags, hrt_abstime min_reporting_interval = 2_s) : _min_reporting_interval(min_reporting_interval), _failsafe_flags(failsafe_flags) { } + ~Report() = default; failsafe_flags_s &failsafeFlags() { @@ -181,16 +183,14 @@ class Report { * Whether arming is possible for a given navigation mode */ bool canArm(uint8_t nav_state) const { - return _results[_current_result].arming_checks.valid && - (uint32_t)(_results[_current_result].arming_checks.can_arm & getModeGroup(nav_state)) != 0; + return _results[_current_result].arming_checks.valid && (uint32_t)(_results[_current_result].arming_checks.can_arm & getModeGroup(nav_state)) != 0; } /** * Whether a navigation mode can be run (while already armed) */ bool canRun(uint8_t nav_state) const { - return _results[_current_result].arming_checks.valid && - (uint32_t)(_results[_current_result].arming_checks.can_run & getModeGroup(nav_state)) != 0; + return _results[_current_result].arming_checks.valid && (uint32_t)(_results[_current_result].arming_checks.can_run & getModeGroup(nav_state)) != 0; } void getHealthReport(health_report_s &report) const; @@ -235,6 +235,7 @@ class Report { const HealthResults &healthResults() const { return _results[_current_result].health; } + const ArmingCheckResults &armingCheckResults() const { return _results[_current_result].arming_checks; } @@ -268,8 +269,7 @@ class Report { } bool operator!=(const Results &other) { - return health != other.health || arming_checks != other.arming_checks || - num_events != other.num_events || event_id_hash != other.event_id_hash; + return health != other.health || arming_checks != other.arming_checks || num_events != other.num_events || event_id_hash != other.event_id_hash; } }; @@ -385,7 +385,7 @@ bool Report::addEvent(uint32_t event_id, const events::LogLevels &log_levels, co class HealthAndArmingCheckBase : public ModuleParams { public: HealthAndArmingCheckBase() : - ModuleParams(nullptr){}; + ModuleParams(nullptr) {}; ~HealthAndArmingCheckBase() = default; virtual void checkAndReport(const Context &context, Report &reporter) = 0; diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/accelerometerCheck.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/accelerometerCheck.hpp index 78045f9afc..20ca544738 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/accelerometerCheck.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/accelerometerCheck.hpp @@ -17,7 +17,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class AccelerometerChecks : public HealthAndArmingCheckBase { public: diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/airspeedCheck.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/airspeedCheck.hpp index 2e3be742a3..1d7ad210e2 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/airspeedCheck.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/airspeedCheck.hpp @@ -15,7 +15,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class AirspeedChecks : public HealthAndArmingCheckBase { public: diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/baroCheck.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/baroCheck.hpp index 5b5cab26d6..e4c8aec1a2 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/baroCheck.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/baroCheck.hpp @@ -17,7 +17,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class BaroChecks : public HealthAndArmingCheckBase { public: diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/batteryCheck.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/batteryCheck.hpp index 5883788908..07ce7cfa03 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/batteryCheck.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/batteryCheck.hpp @@ -16,7 +16,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class BatteryChecks : public HealthAndArmingCheckBase { public: diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/cpuResourceCheck.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/cpuResourceCheck.hpp index c4279cee2d..027688f3e6 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/cpuResourceCheck.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/cpuResourceCheck.hpp @@ -15,7 +15,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class CpuResourceChecks : public HealthAndArmingCheckBase { public: diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/distanceSensorChecks.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/distanceSensorChecks.hpp index 860d637474..8ebb522c15 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/distanceSensorChecks.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/distanceSensorChecks.hpp @@ -15,7 +15,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class DistanceSensorChecks : public HealthAndArmingCheckBase { public: diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/escCheck.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/escCheck.hpp index f22f7a8709..7c3a87134c 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/escCheck.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/escCheck.hpp @@ -15,7 +15,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class EscChecks : public HealthAndArmingCheckBase { public: diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/estimatorCheck.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/estimatorCheck.hpp index 1fdd20fa67..78229eb757 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/estimatorCheck.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/estimatorCheck.hpp @@ -25,7 +25,7 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class EstimatorChecks : public HealthAndArmingCheckBase { public: diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/flightTimeCheck.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/flightTimeCheck.hpp index 1cb9ecef29..ffc142f3cb 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/flightTimeCheck.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/flightTimeCheck.hpp @@ -13,7 +13,7 @@ #include "../Common.hpp" using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class FlightTimeChecks : public HealthAndArmingCheckBase { public: diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/magnetometerCheck.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/magnetometerCheck.hpp index 19229cf4b8..ee38a81a56 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/magnetometerCheck.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/magnetometerCheck.hpp @@ -17,7 +17,7 @@ #include #include -using namespace nextpilot::global_params; +using namespace nextpilot::param; class MagnetometerChecks : public HealthAndArmingCheckBase { public: diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/modeCheck.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/modeCheck.hpp index 8f16c926fd..ce32e7edcc 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/modeCheck.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/modeCheck.hpp @@ -14,7 +14,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class ModeChecks : public HealthAndArmingCheckBase { public: diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/offboardCheck.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/offboardCheck.hpp index b64fee3df9..cf70b4802f 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/offboardCheck.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/offboardCheck.hpp @@ -14,7 +14,7 @@ #include #include -using namespace nextpilot::global_params; +using namespace nextpilot::param; using namespace nextpilot; class OffboardChecks : public HealthAndArmingCheckBase { diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/parachuteCheck.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/parachuteCheck.hpp index d0d4c1f57f..c283b6a153 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/parachuteCheck.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/parachuteCheck.hpp @@ -13,7 +13,7 @@ #include "../Common.hpp" using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class ParachuteChecks : public HealthAndArmingCheckBase { public: diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/powerCheck.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/powerCheck.hpp index 87afd56f2b..9c641565bd 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/powerCheck.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/powerCheck.hpp @@ -15,7 +15,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class PowerChecks : public HealthAndArmingCheckBase { public: diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/rcAndDataLinkCheck.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/rcAndDataLinkCheck.hpp index cf77bb1e84..c55d783984 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/rcAndDataLinkCheck.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/rcAndDataLinkCheck.hpp @@ -15,7 +15,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class RcAndDataLinkChecks : public HealthAndArmingCheckBase { public: diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/rcCalibrationCheck.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/rcCalibrationCheck.hpp index ca1865ad13..18be322ed1 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/rcCalibrationCheck.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/rcCalibrationCheck.hpp @@ -15,7 +15,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class RcCalibrationChecks : public HealthAndArmingCheckBase { public: diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/sdcardCheck.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/sdcardCheck.hpp index 705d1c5bf1..5e6f1736b1 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/sdcardCheck.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/sdcardCheck.hpp @@ -13,7 +13,7 @@ #include "../Common.hpp" using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class SdCardChecks : public HealthAndArmingCheckBase { public: @@ -26,10 +26,10 @@ class SdCardChecks : public HealthAndArmingCheckBase { #ifdef PX4_STORAGEDIR bool _sdcard_detected{false}; -#ifdef __PX4_NUTTX +# ifdef __PX4_NUTTX bool _hardfault_checked_once{false}; bool _hardfault_file_present{false}; -#endif +# endif #endif DEFINE_PARAMETERS_CUSTOM_PARENT(HealthAndArmingCheckBase, diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/systemCheck.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/systemCheck.hpp index 9c8b82a692..1c9acae306 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/systemCheck.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/systemCheck.hpp @@ -15,7 +15,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class SystemChecks : public HealthAndArmingCheckBase { public: diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/vtolCheck.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/vtolCheck.hpp index bfc3a4e343..791ff466d7 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/vtolCheck.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/vtolCheck.hpp @@ -15,7 +15,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class VtolChecks : public HealthAndArmingCheckBase { public: diff --git a/apps/controller/commander/HealthAndArmingChecks/checks/windCheck.hpp b/apps/controller/commander/HealthAndArmingChecks/checks/windCheck.hpp index 087525a914..b214da7b66 100644 --- a/apps/controller/commander/HealthAndArmingChecks/checks/windCheck.hpp +++ b/apps/controller/commander/HealthAndArmingChecks/checks/windCheck.hpp @@ -15,7 +15,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class WindChecks : public HealthAndArmingCheckBase { public: diff --git a/apps/controller/commander/failsafe/framework.h b/apps/controller/commander/failsafe/framework.h index f5a6491cd5..41a0c8ce4e 100644 --- a/apps/controller/commander/failsafe/framework.h +++ b/apps/controller/commander/failsafe/framework.h @@ -16,7 +16,7 @@ #include using namespace time_literals; -using namespace nextpilot::global_params; +using namespace nextpilot::param; #define CHECK_FAILSAFE(status_flags, flag_name, options) \ checkFailsafe((int)offsetof(failsafe_flags_s, flag_name), lastStatusFlags().flag_name, status_flags.flag_name, options) @@ -65,30 +65,42 @@ class FailsafeBase : public ModuleParams { static const char *actionStr(Action action) { switch (action) { - case Action::None: return "None"; + case Action::None: + return "None"; - case Action::Warn: return "Warn"; + case Action::Warn: + return "Warn"; - case Action::FallbackPosCtrl: return "Fallback to PosCtrl"; + case Action::FallbackPosCtrl: + return "Fallback to PosCtrl"; - case Action::FallbackAltCtrl: return "Fallback to AltCtrl"; + case Action::FallbackAltCtrl: + return "Fallback to AltCtrl"; - case Action::FallbackStab: return "Fallback to Stabilized"; + case Action::FallbackStab: + return "Fallback to Stabilized"; - case Action::Hold: return "Hold"; + case Action::Hold: + return "Hold"; - case Action::RTL: return "RTL"; + case Action::RTL: + return "RTL"; - case Action::Land: return "Land"; + case Action::Land: + return "Land"; - case Action::Descend: return "Descend"; + case Action::Descend: + return "Descend"; - case Action::Disarm: return "Disarm"; + case Action::Disarm: + return "Disarm"; - case Action::Terminate: return "Terminate"; + case Action::Terminate: + return "Terminate"; case Action::Count: - default: return "(invalid)"; + default: + return "(invalid)"; } } @@ -142,9 +154,11 @@ class FailsafeBase : public ModuleParams { * @return true on success, false if failsafe already active */ bool deferFailsafes(bool enabled, int timeout_s); + bool getDeferFailsafes() const { return _defer_failsafes; } + bool failsafeDeferred() const { return _failsafe_defer_started != 0; } @@ -161,18 +175,22 @@ class FailsafeBase : public ModuleParams { ActionOptions(Action action_ = Action::None) : action(action_) { } + ActionOptions &allowUserTakeover(UserTakeoverAllowed allow = UserTakeoverAllowed::Auto) { allow_user_takeover = allow; return *this; } + ActionOptions &clearOn(ClearCondition clear_condition_) { clear_condition = clear_condition_; return *this; } + ActionOptions &causedBy(Cause cause_) { cause = cause_; return *this; } + ActionOptions &cannotBeDeferred() { can_be_deferred = false; return *this; @@ -181,6 +199,7 @@ class FailsafeBase : public ModuleParams { bool valid() const { return id != -1; } + void setInvalid() { id = -1; } diff --git a/apps/controller/commander/failure_detector/FailureDetector.hpp b/apps/controller/commander/failure_detector/FailureDetector.hpp index b03c099d24..a78a27b969 100644 --- a/apps/controller/commander/failure_detector/FailureDetector.hpp +++ b/apps/controller/commander/failure_detector/FailureDetector.hpp @@ -42,7 +42,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; union failure_detector_status_u { struct { diff --git a/apps/controller/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturation.hpp b/apps/controller/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturation.hpp index 0e275cef41..01fa0a1f6b 100644 --- a/apps/controller/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturation.hpp +++ b/apps/controller/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturation.hpp @@ -23,13 +23,14 @@ #include "ControlAllocationPseudoInverse.hpp" #include -using namespace nextpilot::global_params; +using namespace nextpilot::param; class ControlAllocationSequentialDesaturation : public ControlAllocationPseudoInverse, public ModuleParams { public: ControlAllocationSequentialDesaturation() : ModuleParams(nullptr) { } + virtual ~ControlAllocationSequentialDesaturation() = default; void allocate() override; diff --git a/apps/controller/control_allocator/ControlAllocator.hpp b/apps/controller/control_allocator/ControlAllocator.hpp index 699cafee8a..d06dd8312b 100644 --- a/apps/controller/control_allocator/ControlAllocator.hpp +++ b/apps/controller/control_allocator/ControlAllocator.hpp @@ -51,8 +51,8 @@ #include #include -using namespace nextpilot::global_params; -using namespace nextpilot; +using namespace nextpilot::param; +using namespace nextpilot::workq; class ControlAllocator : public ModuleCommand, public ModuleParams, public WorkItemScheduled { public: diff --git a/apps/controller/flight_mode_manager/tasks/AutoFollowTarget/follow_target_estimator/TargetEstimator.hpp b/apps/controller/flight_mode_manager/tasks/AutoFollowTarget/follow_target_estimator/TargetEstimator.hpp index ca878b993f..81767c3a47 100644 --- a/apps/controller/flight_mode_manager/tasks/AutoFollowTarget/follow_target_estimator/TargetEstimator.hpp +++ b/apps/controller/flight_mode_manager/tasks/AutoFollowTarget/follow_target_estimator/TargetEstimator.hpp @@ -40,7 +40,8 @@ static constexpr float MINIMUM_SPEED_FOR_TARGET_MOVING = 0.1f; // speed thr using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; struct filter_gains_s { // Position fusion gains diff --git a/apps/controller/flight_mode_manager/tasks/FlightTask/FlightTask.hpp b/apps/controller/flight_mode_manager/tasks/FlightTask/FlightTask.hpp index 59fdf3e714..b0340d1f9a 100644 --- a/apps/controller/flight_mode_manager/tasks/FlightTask/FlightTask.hpp +++ b/apps/controller/flight_mode_manager/tasks/FlightTask/FlightTask.hpp @@ -34,7 +34,8 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; struct ekf_reset_counters_s { uint8_t xy; diff --git a/apps/controller/flight_mode_manager/tasks/Utility/StickAccelerationXY.hpp b/apps/controller/flight_mode_manager/tasks/Utility/StickAccelerationXY.hpp index 38efdc5dbc..e9ff7563a5 100644 --- a/apps/controller/flight_mode_manager/tasks/Utility/StickAccelerationXY.hpp +++ b/apps/controller/flight_mode_manager/tasks/Utility/StickAccelerationXY.hpp @@ -24,7 +24,7 @@ #include "SlewRate.hpp" using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class StickAccelerationXY : public ModuleParams { public: diff --git a/apps/controller/flight_mode_manager/tasks/Utility/StickTiltXY.hpp b/apps/controller/flight_mode_manager/tasks/Utility/StickTiltXY.hpp index 80cf0000b8..416e7e0cd8 100644 --- a/apps/controller/flight_mode_manager/tasks/Utility/StickTiltXY.hpp +++ b/apps/controller/flight_mode_manager/tasks/Utility/StickTiltXY.hpp @@ -21,7 +21,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class StickTiltXY : public ModuleParams { public: diff --git a/apps/controller/flight_mode_manager/tasks/Utility/StickYaw.hpp b/apps/controller/flight_mode_manager/tasks/Utility/StickYaw.hpp index 7f8198b481..654a8c03df 100644 --- a/apps/controller/flight_mode_manager/tasks/Utility/StickYaw.hpp +++ b/apps/controller/flight_mode_manager/tasks/Utility/StickYaw.hpp @@ -20,7 +20,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class StickYaw : public ModuleParams { public: diff --git a/apps/controller/flight_mode_manager/tasks/Utility/Sticks.hpp b/apps/controller/flight_mode_manager/tasks/Utility/Sticks.hpp index f925876c46..db6ac5902d 100644 --- a/apps/controller/flight_mode_manager/tasks/Utility/Sticks.hpp +++ b/apps/controller/flight_mode_manager/tasks/Utility/Sticks.hpp @@ -26,7 +26,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class Sticks : public ModuleParams { public: diff --git a/apps/controller/fw_att_control/FixedwingAttitudeControl.hpp b/apps/controller/fw_att_control/FixedwingAttitudeControl.hpp index 4b01ad0a93..43afd75d54 100644 --- a/apps/controller/fw_att_control/FixedwingAttitudeControl.hpp +++ b/apps/controller/fw_att_control/FixedwingAttitudeControl.hpp @@ -47,7 +47,8 @@ using matrix::Quatf; using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; using uORB::SubscriptionData; diff --git a/apps/controller/fw_autotune_attitude_control/fw_autotune_attitude_control.hpp b/apps/controller/fw_autotune_attitude_control/fw_autotune_attitude_control.hpp index 26311f354e..7d1f978d4d 100644 --- a/apps/controller/fw_autotune_attitude_control/fw_autotune_attitude_control.hpp +++ b/apps/controller/fw_autotune_attitude_control/fw_autotune_attitude_control.hpp @@ -40,7 +40,8 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; class FwAutotuneAttitudeControl : public ModuleCommand, public ModuleParams, public WorkItem { public: diff --git a/apps/controller/fw_pos_control/FixedwingPositionControl.hpp b/apps/controller/fw_pos_control/FixedwingPositionControl.hpp index 4b08afed90..3c9bd99b5c 100644 --- a/apps/controller/fw_pos_control/FixedwingPositionControl.hpp +++ b/apps/controller/fw_pos_control/FixedwingPositionControl.hpp @@ -75,7 +75,8 @@ using namespace launchdetection; using namespace runwaytakeoff; using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; using matrix::Vector2d; using matrix::Vector2f; diff --git a/apps/controller/fw_pos_control/launchdetection/LaunchDetector.h b/apps/controller/fw_pos_control/launchdetection/LaunchDetector.h index b2d4956dec..eab247ac0f 100644 --- a/apps/controller/fw_pos_control/launchdetection/LaunchDetector.h +++ b/apps/controller/fw_pos_control/launchdetection/LaunchDetector.h @@ -21,7 +21,7 @@ #include #include -using namespace nextpilot::global_params; +using namespace nextpilot::param; namespace launchdetection { @@ -33,6 +33,7 @@ class __EXPORT LaunchDetector : public ModuleParams { LaunchDetector(ModuleParams *parent) : ModuleParams(parent) { } + ~LaunchDetector() = default; LaunchDetector(const LaunchDetector &) = delete; diff --git a/apps/controller/fw_pos_control/runway_takeoff/RunwayTakeoff.h b/apps/controller/fw_pos_control/runway_takeoff/RunwayTakeoff.h index 49ef6453eb..1fa2fd4b54 100644 --- a/apps/controller/fw_pos_control/runway_takeoff/RunwayTakeoff.h +++ b/apps/controller/fw_pos_control/runway_takeoff/RunwayTakeoff.h @@ -27,7 +27,7 @@ #include #include -using namespace nextpilot::global_params; +using namespace nextpilot::param; namespace runwaytakeoff { @@ -43,6 +43,7 @@ class __EXPORT RunwayTakeoff : public ModuleParams { RunwayTakeoff(ModuleParams *parent) : ModuleParams(parent) { } + ~RunwayTakeoff() = default; /** diff --git a/apps/controller/fw_rate_control/FixedwingRateControl.hpp b/apps/controller/fw_rate_control/FixedwingRateControl.hpp index 5b6be2b35d..7f9c7e4711 100644 --- a/apps/controller/fw_rate_control/FixedwingRateControl.hpp +++ b/apps/controller/fw_rate_control/FixedwingRateControl.hpp @@ -47,8 +47,8 @@ using matrix::Quatf; using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; -using uORB::SubscriptionData; +using namespace nextpilot::workq; +using namespace nextpilot::param; class FixedwingRateControl final : public ModuleCommand, public ModuleParams, public WorkItemScheduled { public: diff --git a/apps/controller/land_detector/LandDetector.h b/apps/controller/land_detector/LandDetector.h index 6783998fbe..f2e6748f1b 100644 --- a/apps/controller/land_detector/LandDetector.h +++ b/apps/controller/land_detector/LandDetector.h @@ -44,7 +44,8 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; namespace land_detector { diff --git a/apps/controller/manual_control/ManualControl.hpp b/apps/controller/manual_control/ManualControl.hpp index 17ad2b2230..b219f742fb 100644 --- a/apps/controller/manual_control/ManualControl.hpp +++ b/apps/controller/manual_control/ManualControl.hpp @@ -32,7 +32,8 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; class ManualControl : public ModuleCommand, public ModuleParams, public WorkItemScheduled { public: diff --git a/apps/controller/mc_att_control/mc_att_control.hpp b/apps/controller/mc_att_control/mc_att_control.hpp index 47038ba1ef..a37731aebc 100644 --- a/apps/controller/mc_att_control/mc_att_control.hpp +++ b/apps/controller/mc_att_control/mc_att_control.hpp @@ -34,9 +34,10 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; -class MulticopterAttitudeControl : public ModuleCommand, public ModuleParams, public nextpilot::WorkItem { +class MulticopterAttitudeControl : public ModuleCommand, public ModuleParams, public WorkItem { public: MulticopterAttitudeControl(bool vtol = false); ~MulticopterAttitudeControl() override; @@ -86,12 +87,12 @@ class MulticopterAttitudeControl : public ModuleCommand _man_roll_input_filter; AlphaFilter _man_pitch_input_filter; diff --git a/apps/controller/mc_autotune_attitude_control/mc_autotune_attitude_control.hpp b/apps/controller/mc_autotune_attitude_control/mc_autotune_attitude_control.hpp index 8390ae6c3f..075339c693 100644 --- a/apps/controller/mc_autotune_attitude_control/mc_autotune_attitude_control.hpp +++ b/apps/controller/mc_autotune_attitude_control/mc_autotune_attitude_control.hpp @@ -38,7 +38,8 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; class McAutotuneAttitudeControl : public ModuleCommand, public ModuleParams, public WorkItem { public: diff --git a/apps/controller/mc_hover_thrust_estimator/MulticopterHoverThrustEstimator.hpp b/apps/controller/mc_hover_thrust_estimator/MulticopterHoverThrustEstimator.hpp index 242e1026cc..f9f8f8d4dd 100644 --- a/apps/controller/mc_hover_thrust_estimator/MulticopterHoverThrustEstimator.hpp +++ b/apps/controller/mc_hover_thrust_estimator/MulticopterHoverThrustEstimator.hpp @@ -39,7 +39,8 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; class MulticopterHoverThrustEstimator : public ModuleCommand, public ModuleParams, public WorkItem { public: diff --git a/apps/controller/mc_pos_control/MulticopterPositionControl.hpp b/apps/controller/mc_pos_control/MulticopterPositionControl.hpp index 73602c6363..351371864c 100644 --- a/apps/controller/mc_pos_control/MulticopterPositionControl.hpp +++ b/apps/controller/mc_pos_control/MulticopterPositionControl.hpp @@ -40,8 +40,8 @@ #include using namespace time_literals; -using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; class MulticopterPositionControl : public ModuleCommand, public control::SuperBlock, public ModuleParams, public WorkItemScheduled { public: diff --git a/apps/controller/mc_rate_control/MulticopterRateControl.cpp b/apps/controller/mc_rate_control/MulticopterRateControl.cpp index c5ce129c29..dbb9ee7a43 100644 --- a/apps/controller/mc_rate_control/MulticopterRateControl.cpp +++ b/apps/controller/mc_rate_control/MulticopterRateControl.cpp @@ -16,11 +16,12 @@ using namespace matrix; using namespace time_literals; +using namespace nextpilot::workq; using math::radians; MulticopterRateControl::MulticopterRateControl(bool vtol) : ModuleParams(nullptr), - WorkItem(MODULE_NAME, nextpilot::wq_configurations::rate_ctrl), + WorkItem(MODULE_NAME, wq_configurations::rate_ctrl), _vehicle_torque_setpoint_pub(vtol ? ORB_ID(vehicle_torque_setpoint_virtual_mc) : ORB_ID(vehicle_torque_setpoint)), _vehicle_thrust_setpoint_pub(vtol ? ORB_ID(vehicle_thrust_setpoint_virtual_mc) : ORB_ID(vehicle_thrust_setpoint)), _loop_perf(perf_alloc(PC_ELAPSED, MODULE_NAME ": cycle")) { diff --git a/apps/controller/mc_rate_control/MulticopterRateControl.hpp b/apps/controller/mc_rate_control/MulticopterRateControl.hpp index 50a13df770..f9b0ff0eec 100644 --- a/apps/controller/mc_rate_control/MulticopterRateControl.hpp +++ b/apps/controller/mc_rate_control/MulticopterRateControl.hpp @@ -36,9 +36,10 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; -class MulticopterRateControl : public ModuleCommand, public ModuleParams, public nextpilot::WorkItem { +class MulticopterRateControl : public ModuleCommand, public ModuleParams, public WorkItem { public: MulticopterRateControl(bool vtol = false); ~MulticopterRateControl() override; diff --git a/apps/controller/navigator/MissionFeasibility/FeasibilityChecker.hpp b/apps/controller/navigator/MissionFeasibility/FeasibilityChecker.hpp index cf4a8f875f..2020a95db4 100644 --- a/apps/controller/navigator/MissionFeasibility/FeasibilityChecker.hpp +++ b/apps/controller/navigator/MissionFeasibility/FeasibilityChecker.hpp @@ -19,7 +19,7 @@ #include #include -using namespace nextpilot::global_params; +using namespace nextpilot::param; using namespace nextpilot; class FeasibilityChecker : public ModuleParams { diff --git a/apps/controller/navigator/geofence.h b/apps/controller/navigator/geofence.h index 37809caafe..29722688bb 100644 --- a/apps/controller/navigator/geofence.h +++ b/apps/controller/navigator/geofence.h @@ -31,7 +31,7 @@ #define GEOFENCE_FILENAME PX4_STORAGEDIR "/etc/geofence.txt" -using namespace nextpilot::global_params; +using namespace nextpilot::param; using namespace nextpilot; class Navigator; diff --git a/apps/controller/navigator/mission.h b/apps/controller/navigator/mission.h index f7978cf2a1..b30c41c0ed 100644 --- a/apps/controller/navigator/mission.h +++ b/apps/controller/navigator/mission.h @@ -43,7 +43,7 @@ #include #include -using namespace nextpilot::global_params; +using namespace nextpilot::param; using namespace nextpilot; class Navigator; diff --git a/apps/controller/navigator/navigator.h b/apps/controller/navigator/navigator.h index 74c909959f..2d33206ef3 100644 --- a/apps/controller/navigator/navigator.h +++ b/apps/controller/navigator/navigator.h @@ -58,7 +58,7 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; /** * Number of navigation modes that need on_active/on_inactive calls diff --git a/apps/controller/navigator/precland.h b/apps/controller/navigator/precland.h index 91e237eeba..2da641084b 100644 --- a/apps/controller/navigator/precland.h +++ b/apps/controller/navigator/precland.h @@ -25,7 +25,7 @@ #include "navigator_mode.h" #include "mission_block.h" -using namespace nextpilot::global_params; +using namespace nextpilot::param; using namespace nextpilot; enum class PrecLandState { diff --git a/apps/controller/navigator/rtl.h b/apps/controller/navigator/rtl.h index f6ad1874b6..8a95430de1 100644 --- a/apps/controller/navigator/rtl.h +++ b/apps/controller/navigator/rtl.h @@ -29,7 +29,7 @@ #include #include -using namespace nextpilot::global_params; +using namespace nextpilot::param; using namespace nextpilot; class Navigator; diff --git a/apps/controller/navigator/vtol_takeoff.h b/apps/controller/navigator/vtol_takeoff.h index 68ce7499c8..1fadbfb2d6 100644 --- a/apps/controller/navigator/vtol_takeoff.h +++ b/apps/controller/navigator/vtol_takeoff.h @@ -21,7 +21,7 @@ #include #include -using namespace nextpilot::global_params; +using namespace nextpilot::param; class VtolTakeoff : public MissionBlock, public ModuleParams { public: diff --git a/apps/controller/rc_update/rc_update.h b/apps/controller/rc_update/rc_update.h index 6eda7a6334..a4a7f8f73a 100644 --- a/apps/controller/rc_update/rc_update.h +++ b/apps/controller/rc_update/rc_update.h @@ -30,7 +30,8 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; namespace rc_update { diff --git a/apps/controller/vtol_att_control/tailsitter.h b/apps/controller/vtol_att_control/tailsitter.h index 77e3ccdee9..4f564b0be5 100644 --- a/apps/controller/vtol_att_control/tailsitter.h +++ b/apps/controller/vtol_att_control/tailsitter.h @@ -25,7 +25,7 @@ #include #include -using namespace nextpilot::global_params; +using namespace nextpilot::param; // [rad] Pitch threshold required for completing transition to fixed-wing in automatic transitions static constexpr float PITCH_THRESHOLD_AUTO_TRANSITION_TO_FW = -1.05f; // -60° @@ -54,7 +54,7 @@ class Tailsitter : public VtolType { vtol_mode _vtol_mode{vtol_mode::MC_MODE}; /**< vtol flight mode, defined by enum vtol_mode */ - bool _flag_was_in_trans_mode = false; // true if mode has just switched to transition + bool _flag_was_in_trans_mode = false; // true if mode has just switched to transition matrix::Quatf _q_trans_start; matrix::Quatf _q_trans_sp; diff --git a/apps/controller/vtol_att_control/tiltrotor.h b/apps/controller/vtol_att_control/tiltrotor.h index 84cc845216..06e512df88 100644 --- a/apps/controller/vtol_att_control/tiltrotor.h +++ b/apps/controller/vtol_att_control/tiltrotor.h @@ -25,7 +25,7 @@ #include #include -using namespace nextpilot::global_params; +using namespace nextpilot::param; using namespace nextpilot; class Tiltrotor : public VtolType { diff --git a/apps/controller/vtol_att_control/vtol_att_control_main.h b/apps/controller/vtol_att_control/vtol_att_control_main.h index e20bf99e1b..8ac4411eb7 100644 --- a/apps/controller/vtol_att_control/vtol_att_control_main.h +++ b/apps/controller/vtol_att_control/vtol_att_control_main.h @@ -63,8 +63,9 @@ #include "tiltrotor.h" using namespace time_literals; -using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::uORB; +using namespace nextpilot::workq; +using namespace nextpilot::param; extern "C" __EXPORT int vtol_att_control_main(int argc, char *argv[]); diff --git a/apps/controller/vtol_att_control/vtol_type.h b/apps/controller/vtol_att_control/vtol_type.h index f499c42bc3..82a7f26250 100644 --- a/apps/controller/vtol_att_control/vtol_type.h +++ b/apps/controller/vtol_att_control/vtol_type.h @@ -24,7 +24,7 @@ #include #include -using namespace nextpilot::global_params; +using namespace nextpilot::param; static constexpr float kFlapSlewRateVtol = 1.f; // minimum time from none to full flap deflection [s] static constexpr float kSpoilerSlewRateVtol = 1.f; // minimum time from none to full spoiler deflection [s] @@ -194,7 +194,7 @@ class VtolType : public ModuleParams { */ float pusher_assist(); - virtual void blendThrottleAfterFrontTransition(float scale){}; + virtual void blendThrottleAfterFrontTransition(float scale) {}; mode get_mode() { return _common_vtol_mode; @@ -288,7 +288,7 @@ class VtolType : public ModuleParams { bool isFrontTransitionCompleted(); virtual bool isFrontTransitionCompletedBase(); - float _dt{0.0025f}; // time step [s] + float _dt{0.0025f}; // time step [s] float _local_position_z_start_of_transition{0.f}; // altitude at start of transition @@ -332,6 +332,7 @@ class VtolType : public ModuleParams { void resetAccelToPitchPitchIntegrator() { _accel_to_pitch_integ = 0.f; } + bool shouldBlendThrottleAfterFrontTransition() { return _throttle_blend_start_ts != 0; }; diff --git a/apps/estimator/airspeed_selector/airspeed_selector_main.cpp b/apps/estimator/airspeed_selector/airspeed_selector_main.cpp index 06aaca3e11..e2c405f9ba 100644 --- a/apps/estimator/airspeed_selector/airspeed_selector_main.cpp +++ b/apps/estimator/airspeed_selector/airspeed_selector_main.cpp @@ -44,7 +44,7 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; static constexpr uint32_t SCHEDULE_INTERVAL{100_ms}; /**< The schedule interval in usec (10 Hz) */ diff --git a/apps/estimator/attitude_estimator_q/attitude_estimator_q_main.cpp b/apps/estimator/attitude_estimator_q/attitude_estimator_q_main.cpp index 1e11028a65..6f1e1c7b85 100644 --- a/apps/estimator/attitude_estimator_q/attitude_estimator_q_main.cpp +++ b/apps/estimator/attitude_estimator_q/attitude_estimator_q_main.cpp @@ -48,7 +48,7 @@ using matrix::wrap_pi; using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class AttitudeEstimatorQ : public ModuleCommand, public ModuleParams, public WorkItem { public: diff --git a/apps/estimator/ekf2_fake/ekf2_fake.hpp b/apps/estimator/ekf2_fake/ekf2_fake.hpp index 1150bce0a5..e7780a6473 100644 --- a/apps/estimator/ekf2_fake/ekf2_fake.hpp +++ b/apps/estimator/ekf2_fake/ekf2_fake.hpp @@ -14,7 +14,7 @@ using namespace nextpilot; using namespace time_literals; -using namespace nextpilot::global_params; +using namespace nextpilot::param; #define USING_COMMANDER_FAKE diff --git a/apps/estimator/gyro_calibration/GyroCalibration.hpp b/apps/estimator/gyro_calibration/GyroCalibration.hpp index f23a4d4d71..b4877fcd77 100644 --- a/apps/estimator/gyro_calibration/GyroCalibration.hpp +++ b/apps/estimator/gyro_calibration/GyroCalibration.hpp @@ -27,7 +27,7 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class GyroCalibration : public ModuleCommand, public ModuleParams, public WorkItemScheduled { public: diff --git a/apps/estimator/local_position_estimator/BlockLocalPositionEstimator.hpp b/apps/estimator/local_position_estimator/BlockLocalPositionEstimator.hpp index 209795bc0a..29e18b555b 100644 --- a/apps/estimator/local_position_estimator/BlockLocalPositionEstimator.hpp +++ b/apps/estimator/local_position_estimator/BlockLocalPositionEstimator.hpp @@ -50,7 +50,8 @@ using namespace matrix; using namespace control; using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; static const float DELAY_MAX = 0.5f; // seconds static const float HIST_STEP = 0.05f; // 20 hz diff --git a/apps/estimator/mag_bias_estimator/MagBiasEstimator.hpp b/apps/estimator/mag_bias_estimator/MagBiasEstimator.hpp index 37dba017fa..d101263e8b 100644 --- a/apps/estimator/mag_bias_estimator/MagBiasEstimator.hpp +++ b/apps/estimator/mag_bias_estimator/MagBiasEstimator.hpp @@ -28,7 +28,8 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; namespace mag_bias_estimator { diff --git a/apps/estimator/sensors/vehicle_acceleration/VehicleAcceleration.hpp b/apps/estimator/sensors/vehicle_acceleration/VehicleAcceleration.hpp index 2e5969e447..b6cbe22b81 100644 --- a/apps/estimator/sensors/vehicle_acceleration/VehicleAcceleration.hpp +++ b/apps/estimator/sensors/vehicle_acceleration/VehicleAcceleration.hpp @@ -28,7 +28,7 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; namespace sensors { diff --git a/apps/estimator/sensors/vehicle_air_data/VehicleAirData.hpp b/apps/estimator/sensors/vehicle_air_data/VehicleAirData.hpp index facd8f7a6d..61ee1854af 100644 --- a/apps/estimator/sensors/vehicle_air_data/VehicleAirData.hpp +++ b/apps/estimator/sensors/vehicle_air_data/VehicleAirData.hpp @@ -29,7 +29,8 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; namespace sensors { class VehicleAirData : public ModuleParams, public WorkItemScheduled { diff --git a/apps/estimator/sensors/vehicle_angular_velocity/VehicleAngularVelocity.hpp b/apps/estimator/sensors/vehicle_angular_velocity/VehicleAngularVelocity.hpp index f150f3b805..493e816892 100644 --- a/apps/estimator/sensors/vehicle_angular_velocity/VehicleAngularVelocity.hpp +++ b/apps/estimator/sensors/vehicle_angular_velocity/VehicleAngularVelocity.hpp @@ -35,7 +35,8 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; namespace sensors { diff --git a/apps/estimator/sensors/vehicle_gps_position/VehicleGPSPosition.hpp b/apps/estimator/sensors/vehicle_gps_position/VehicleGPSPosition.hpp index cb0ce88894..f99ac7ab4d 100644 --- a/apps/estimator/sensors/vehicle_gps_position/VehicleGPSPosition.hpp +++ b/apps/estimator/sensors/vehicle_gps_position/VehicleGPSPosition.hpp @@ -25,7 +25,8 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; namespace sensors { class VehicleGPSPosition : public ModuleParams, public WorkItemScheduled { diff --git a/apps/estimator/sensors/vehicle_imu/VehicleIMU.hpp b/apps/estimator/sensors/vehicle_imu/VehicleIMU.hpp index eb6c4cd63b..ec37140f0e 100644 --- a/apps/estimator/sensors/vehicle_imu/VehicleIMU.hpp +++ b/apps/estimator/sensors/vehicle_imu/VehicleIMU.hpp @@ -34,7 +34,8 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; namespace sensors { diff --git a/apps/estimator/sensors/vehicle_magnetometer/VehicleMagnetometer.hpp b/apps/estimator/sensors/vehicle_magnetometer/VehicleMagnetometer.hpp index 89ce28c7aa..9183ab1d26 100644 --- a/apps/estimator/sensors/vehicle_magnetometer/VehicleMagnetometer.hpp +++ b/apps/estimator/sensors/vehicle_magnetometer/VehicleMagnetometer.hpp @@ -38,7 +38,8 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; namespace sensors { class VehicleMagnetometer : public ModuleParams, public WorkItemScheduled { diff --git a/apps/estimator/sensors/vehicle_optical_flow/VehicleOpticalFlow.hpp b/apps/estimator/sensors/vehicle_optical_flow/VehicleOpticalFlow.hpp index 4610ba3d83..3b2b3769ca 100644 --- a/apps/estimator/sensors/vehicle_optical_flow/VehicleOpticalFlow.hpp +++ b/apps/estimator/sensors/vehicle_optical_flow/VehicleOpticalFlow.hpp @@ -34,7 +34,8 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; namespace sensors { diff --git a/apps/estimator/sensors/voted_sensors_update.h b/apps/estimator/sensors/voted_sensors_update.h index 6e678feb4f..b9dda81ef6 100644 --- a/apps/estimator/sensors/voted_sensors_update.h +++ b/apps/estimator/sensors/voted_sensors_update.h @@ -35,7 +35,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; namespace sensors { diff --git a/apps/estimator/temperature_compensation/TemperatureCompensationModule.h b/apps/estimator/temperature_compensation/TemperatureCompensationModule.h index b37ae4c4a8..7ba1b8d823 100644 --- a/apps/estimator/temperature_compensation/TemperatureCompensationModule.h +++ b/apps/estimator/temperature_compensation/TemperatureCompensationModule.h @@ -33,7 +33,8 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; namespace temperature_compensation { diff --git a/apps/libraries/controller/avoidance/ObstacleAvoidance.hpp b/apps/libraries/controller/avoidance/ObstacleAvoidance.hpp index e87dcd3eae..05bf25027f 100644 --- a/apps/libraries/controller/avoidance/ObstacleAvoidance.hpp +++ b/apps/libraries/controller/avoidance/ObstacleAvoidance.hpp @@ -34,7 +34,7 @@ #include using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; const vehicle_trajectory_waypoint_s empty_trajectory_waypoint = {0, 0, {0, 0, 0, 0, 0, 0, 0}, { {0, {NAN, NAN, NAN}, {NAN, NAN, NAN}, {NAN, NAN, NAN}, NAN, NAN, false, UINT8_MAX, {0, 0}}, diff --git a/apps/libraries/controller/collision_prevention/CollisionPrevention.hpp b/apps/libraries/controller/collision_prevention/CollisionPrevention.hpp index 7276e0d883..f41ae1041e 100644 --- a/apps/libraries/controller/collision_prevention/CollisionPrevention.hpp +++ b/apps/libraries/controller/collision_prevention/CollisionPrevention.hpp @@ -36,7 +36,7 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; class CollisionPrevention : public ModuleParams { diff --git a/apps/libraries/controller/mixer_module/functions/FunctionProviderBase.hpp b/apps/libraries/controller/mixer_module/functions/FunctionProviderBase.hpp index fac9ce9190..5b5b5b7a9a 100644 --- a/apps/libraries/controller/mixer_module/functions/FunctionProviderBase.hpp +++ b/apps/libraries/controller/mixer_module/functions/FunctionProviderBase.hpp @@ -17,6 +17,7 @@ #include using namespace nextpilot; +using namespace nextpilot::workq; class FunctionProviderBase { diff --git a/apps/libraries/controller/mixer_module/mixer_module.hpp b/apps/libraries/controller/mixer_module/mixer_module.hpp index 0aead698f7..0e3f49daca 100644 --- a/apps/libraries/controller/mixer_module/mixer_module.hpp +++ b/apps/libraries/controller/mixer_module/mixer_module.hpp @@ -36,7 +36,8 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::workq; +using namespace nextpilot::param; /** diff --git a/apps/libraries/controller/weather_vane/WeatherVane.hpp b/apps/libraries/controller/weather_vane/WeatherVane.hpp index c1a2aaf94d..f9806265f2 100644 --- a/apps/libraries/controller/weather_vane/WeatherVane.hpp +++ b/apps/libraries/controller/weather_vane/WeatherVane.hpp @@ -27,7 +27,7 @@ #include #include -using namespace nextpilot::global_params; +using namespace nextpilot::param; using namespace nextpilot; class WeatherVane : public ModuleParams diff --git a/apps/libraries/peripheral/notification/led/led.h b/apps/libraries/peripheral/notification/led/led.h index 627082416d..de6629c8d2 100644 --- a/apps/libraries/peripheral/notification/led/led.h +++ b/apps/libraries/peripheral/notification/led/led.h @@ -30,7 +30,7 @@ using namespace time_literals; using namespace nextpilot; -using namespace nextpilot::global_params; +using namespace nextpilot::param; struct LedControlDataSingle { uint8_t color{led_control_s::COLOR_OFF}; ///< one of led_control_s::COLOR_* diff --git a/apps/peripheral/actuator/pwm_out/PWMOut.cpp b/apps/peripheral/actuator/pwm_out/PWMOut.cpp index f7d753ac70..90767e554e 100644 --- a/apps/peripheral/actuator/pwm_out/PWMOut.cpp +++ b/apps/peripheral/actuator/pwm_out/PWMOut.cpp @@ -14,8 +14,10 @@ #include "PWMOut.hpp" #include +using namespace nextpilot::workq; + PWMOut::PWMOut() : - OutputModuleInterface(MODULE_NAME, nextpilot::wq_configurations::hp_default) { + OutputModuleInterface(MODULE_NAME, wq_configurations::hp_default) { _pwm_mask = ((1u << DIRECT_PWM_OUTPUT_CHANNELS) - 1); _mixing_output.setMaxNumOutputs(DIRECT_PWM_OUTPUT_CHANNELS); diff --git a/apps/peripheral/battery/battery_status/battery_status.cpp b/apps/peripheral/battery/battery_status/battery_status.cpp index 807b6fc45e..f19331c860 100644 --- a/apps/peripheral/battery/battery_status/battery_status.cpp +++ b/apps/peripheral/battery/battery_status/battery_status.cpp @@ -28,6 +28,7 @@ #include "analog_battery.h" using namespace time_literals; +using namespace nextpilot::workq; /** * The channel definitions (e.g., ADC_BATTERY_VOLTAGE_CHANNEL, ADC_BATTERY_CURRENT_CHANNEL, and ADC_AIRSPEED_VOLTAGE_CHANNEL) are defined in board_config.h @@ -42,7 +43,7 @@ using namespace time_literals; # error "battery_status module requires power bricks" #endif -class BatteryStatus : public ModuleCommand, public ModuleParams, public nextpilot::WorkItemScheduled { +class BatteryStatus : public ModuleCommand, public ModuleParams, public WorkItemScheduled { public: BatteryStatus(); ~BatteryStatus() override; @@ -102,7 +103,7 @@ class BatteryStatus : public ModuleCommand, public ModuleParams, BatteryStatus::BatteryStatus() : ModuleParams(nullptr), - WorkItemScheduled(MODULE_NAME, nextpilot::wq_configurations::hp_default), + WorkItemScheduled(MODULE_NAME, wq_configurations::hp_default), _battery1(1, this, SAMPLE_INTERVAL_US, battery_status_s::BATTERY_SOURCE_POWER_MODULE, 0), #if BOARD_NUMBER_BRICKS > 1 _battery2(2, this, SAMPLE_INTERVAL_US, battery_status_s::BATTERY_SOURCE_POWER_MODULE, 1), @@ -275,7 +276,7 @@ static int battery_status_main(int argc, char *argv[]) { MSH_CMD_EXPORT_ALIAS(battery_status_main, battery_low_remaining_time, battery status); static int battery_status_start() { - int32_t sys_hitl = param_get_int32((param_t)nextpilot::global_params::params_id::SYS_HITL); + int32_t sys_hitl = param_get_int32((param_t)nextpilot::param::params_id::SYS_HITL); if (sys_hitl > 0) { return 0; } diff --git a/apps/peripheral/battery/esc_battery/EscBattery.cpp b/apps/peripheral/battery/esc_battery/EscBattery.cpp index 7be9a3b7e7..d2896c5b68 100644 --- a/apps/peripheral/battery/esc_battery/EscBattery.cpp +++ b/apps/peripheral/battery/esc_battery/EscBattery.cpp @@ -13,10 +13,11 @@ #include using namespace time_literals; +using namespace nextpilot::workq; EscBattery::EscBattery() : ModuleParams(nullptr), - WorkItem(MODULE_NAME, nextpilot::wq_configurations::lp_default), + WorkItem(MODULE_NAME, wq_configurations::lp_default), _battery(1, this, ESC_BATTERY_INTERVAL_US, battery_status_s::BATTERY_SOURCE_ESCS) { } diff --git a/apps/peripheral/battery/esc_battery/EscBattery.hpp b/apps/peripheral/battery/esc_battery/EscBattery.hpp index d4c5785016..6400c18d26 100644 --- a/apps/peripheral/battery/esc_battery/EscBattery.hpp +++ b/apps/peripheral/battery/esc_battery/EscBattery.hpp @@ -21,8 +21,9 @@ #include using namespace time_literals; +using namespace nextpilot::workq; -class EscBattery : public ModuleCommand, public ModuleParams, public nextpilot::WorkItem { +class EscBattery : public ModuleCommand, public ModuleParams, public WorkItem { public: EscBattery(); ~EscBattery() = default; diff --git a/apps/peripheral/notification/lights/rgbled_pwm/rgbled_pwm.cpp b/apps/peripheral/notification/lights/rgbled_pwm/rgbled_pwm.cpp index e0ae1d0198..ff374cec2c 100644 --- a/apps/peripheral/notification/lights/rgbled_pwm/rgbled_pwm.cpp +++ b/apps/peripheral/notification/lights/rgbled_pwm/rgbled_pwm.cpp @@ -29,9 +29,9 @@ #include #include -using namespace nextpilot; +using namespace nextpilot::workq; -class RGBLED_PWM : public nextpilot::WorkItemScheduled { +class RGBLED_PWM : public WorkItemScheduled { public: RGBLED_PWM(); virtual ~RGBLED_PWM(); @@ -80,7 +80,7 @@ RGBLED_PWM *g_rgbled = nullptr; } RGBLED_PWM::RGBLED_PWM() : - WorkItemScheduled(MODULE_NAME, nextpilot::wq_configurations::lp_default) { + WorkItemScheduled(MODULE_NAME, wq_configurations::lp_default) { } RGBLED_PWM::~RGBLED_PWM() { diff --git a/apps/peripheral/notification/safety_button/SafetyButton.cpp b/apps/peripheral/notification/safety_button/SafetyButton.cpp index 3326225aff..3e793380fe 100644 --- a/apps/peripheral/notification/safety_button/SafetyButton.cpp +++ b/apps/peripheral/notification/safety_button/SafetyButton.cpp @@ -32,7 +32,7 @@ enum class LED_PATTERN : uint16_t { }; SafetyButton::SafetyButton() : - WorkItemScheduled(MODULE_NAME, nextpilot::wq_configurations::hp_default) { + WorkItemScheduled(MODULE_NAME, wq_configurations::hp_default) { _has_px4io = false; //PX4_MFT_HW_SUPPORTED(PX4_MFT_PX4IO); } diff --git a/apps/peripheral/notification/safety_button/SafetyButton.hpp b/apps/peripheral/notification/safety_button/SafetyButton.hpp index 790f1e4818..528b266567 100644 --- a/apps/peripheral/notification/safety_button/SafetyButton.hpp +++ b/apps/peripheral/notification/safety_button/SafetyButton.hpp @@ -19,7 +19,9 @@ #include #include