mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 07:33:34 +08:00
boards: add CONSTRAINED_MEMORY build option
- currently the main change is that it reduces the max number of ORB multi instances to 4, but usage will be expanded as needed - limits number of EKF2 multi instances to 2. - enabled on all cortex m4 boards
This commit is contained in:
committed by
Lorenz Meier
parent
834ac38841
commit
78dff6adcb
@@ -53,8 +53,11 @@
|
||||
#include <uORB/topics/vehicle_global_position.h>
|
||||
#include <uORB/topics/vehicle_odometry.h>
|
||||
|
||||
static constexpr uint8_t EKF2_MAX_INSTANCES{9};
|
||||
static_assert(EKF2_MAX_INSTANCES <= ORB_MULTI_MAX_INSTANCES, "EKF2_MAX_INSTANCES must be <= ORB_MULTI_MAX_INSTANCES");
|
||||
#if CONSTRAINED_MEMORY
|
||||
# define EKF2_MAX_INSTANCES 2
|
||||
#else
|
||||
# define EKF2_MAX_INSTANCES 9
|
||||
#endif
|
||||
|
||||
using namespace time_literals;
|
||||
|
||||
@@ -84,6 +87,7 @@ private:
|
||||
|
||||
// Subscriptions (per estimator instance)
|
||||
struct EstimatorInstance {
|
||||
|
||||
EstimatorInstance(EKF2Selector *selector, uint8_t i) :
|
||||
estimator_attitude_sub{selector, ORB_ID(estimator_attitude), i},
|
||||
estimator_status_sub{selector, ORB_ID(estimator_status), i},
|
||||
@@ -119,13 +123,17 @@ private:
|
||||
EstimatorInstance _instance[EKF2_MAX_INSTANCES] {
|
||||
{this, 0},
|
||||
{this, 1},
|
||||
#if EKF2_MAX_INSTANCES > 2
|
||||
{this, 2},
|
||||
{this, 3},
|
||||
#if EKF2_MAX_INSTANCES > 4
|
||||
{this, 4},
|
||||
{this, 5},
|
||||
{this, 6},
|
||||
{this, 7},
|
||||
{this, 8},
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
static constexpr uint8_t IMU_STATUS_SIZE = (sizeof(sensors_status_imu_s::gyro_inconsistency_rad_s) / sizeof(
|
||||
@@ -136,7 +144,7 @@ private:
|
||||
static_assert(IMU_STATUS_SIZE == sizeof(estimator_selector_status_s::accumulated_accel_error) / sizeof(
|
||||
estimator_selector_status_s::accumulated_accel_error[0]),
|
||||
"increase estimator_selector_status_s::accumulated_accel_error size");
|
||||
static_assert(EKF2_MAX_INSTANCES == sizeof(estimator_selector_status_s::combined_test_ratio) / sizeof(
|
||||
static_assert(EKF2_MAX_INSTANCES <= sizeof(estimator_selector_status_s::combined_test_ratio) / sizeof(
|
||||
estimator_selector_status_s::combined_test_ratio[0]),
|
||||
"increase estimator_selector_status_s::combined_test_ratio size");
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ void LoggedTopics::add_default_topics()
|
||||
add_topic("vehicle_status_flags");
|
||||
add_topic("vtol_vehicle_status", 200);
|
||||
|
||||
// Control allocaton topics
|
||||
// Control allocation topics
|
||||
add_topic("vehicle_angular_acceleration_setpoint", 20);
|
||||
add_topic("vehicle_angular_acceleration", 20);
|
||||
add_topic("vehicle_thrust_setpoint", 20);
|
||||
@@ -126,7 +126,12 @@ void LoggedTopics::add_default_topics()
|
||||
add_topic_multi("telemetry_status", 1000, 4);
|
||||
|
||||
// EKF multi topics (currently max 9 estimators)
|
||||
static constexpr uint8_t MAX_ESTIMATOR_INSTANCES = 4;
|
||||
#if CONSTRAINED_MEMORY
|
||||
static constexpr uint8_t MAX_ESTIMATOR_INSTANCES = 2;
|
||||
#else
|
||||
static constexpr uint8_t MAX_ESTIMATOR_INSTANCES = 6; // artificailly limited until PlotJuggler fixed
|
||||
#endif
|
||||
|
||||
add_topic("estimator_selector_status");
|
||||
add_topic_multi("ekf_gps_drift", 1000, MAX_ESTIMATOR_INSTANCES);
|
||||
add_topic_multi("estimator_attitude", 500, MAX_ESTIMATOR_INSTANCES);
|
||||
|
||||
@@ -58,9 +58,13 @@ struct orb_metadata {
|
||||
typedef const struct orb_metadata *orb_id_t;
|
||||
|
||||
/**
|
||||
* Maximum number of multi topic instances
|
||||
* Maximum number of multi topic instances. This must be <= 10 (because it's the last char of the node path)
|
||||
*/
|
||||
#define ORB_MULTI_MAX_INSTANCES 10 // This must be <= 10 (because it's the last char of the node path)
|
||||
#if defined(CONSTRAINED_MEMORY)
|
||||
# define ORB_MULTI_MAX_INSTANCES 4
|
||||
#else
|
||||
# define ORB_MULTI_MAX_INSTANCES 10
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Generates a pointer to the uORB metadata structure for
|
||||
|
||||
@@ -727,12 +727,14 @@ int uORBTest::UnitTest::test_SubscriptionMulti()
|
||||
ORB_ID::orb_test,
|
||||
ORB_ID::orb_test,
|
||||
ORB_ID::orb_test,
|
||||
#if ORB_MULTI_MAX_INSTANCES > 4
|
||||
ORB_ID::orb_test,
|
||||
ORB_ID::orb_test,
|
||||
ORB_ID::orb_test,
|
||||
ORB_ID::orb_test,
|
||||
ORB_ID::orb_test,
|
||||
ORB_ID::orb_test,
|
||||
#endif
|
||||
};
|
||||
|
||||
uORB::SubscriptionMultiArray<orb_test_s> orb_test_sub_multi_array{ORB_ID::orb_test};
|
||||
|
||||
Reference in New Issue
Block a user