From 234534d9f4f639f18886cfbe04bb7742d3b2c4be Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 18 Aug 2022 19:00:36 +1000 Subject: [PATCH] SITL: allow for extra actuators to be marked as motors --- libraries/SITL/SIM_Aircraft.cpp | 2 +- libraries/SITL/SITL.cpp | 3 +++ libraries/SITL/SITL.h | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/SITL/SIM_Aircraft.cpp b/libraries/SITL/SIM_Aircraft.cpp index 013799b02d..0434abd3c5 100644 --- a/libraries/SITL/SIM_Aircraft.cpp +++ b/libraries/SITL/SIM_Aircraft.cpp @@ -390,7 +390,7 @@ void Aircraft::fill_fdm(struct sitl_fdm &fdm) fdm.velocity_air_bf = velocity_air_bf; fdm.battery_voltage = battery_voltage; fdm.battery_current = battery_current; - fdm.motor_mask = motor_mask; + fdm.motor_mask = motor_mask | sitl->vibe_motor_mask; memcpy(fdm.rpm, rpm, sizeof(fdm.rpm)); fdm.rcin_chan_count = rcin_chan_count; fdm.range = rangefinder_range(); diff --git a/libraries/SITL/SITL.cpp b/libraries/SITL/SITL.cpp index b9cbdb54b3..820661c94d 100644 --- a/libraries/SITL/SITL.cpp +++ b/libraries/SITL/SITL.cpp @@ -174,6 +174,9 @@ const AP_Param::GroupInfo SIM::var_info2[] = { // motor harmonics AP_GROUPINFO("VIB_MOT_HMNC", 60, SIM, vibe_motor_harmonics, 1), + // motor mask, allowing external simulators to mark motors + AP_GROUPINFO("VIB_MOT_MASK", 5, SIM, vibe_motor_mask, 0), + // max motor vibration frequency AP_GROUPINFO("VIB_MOT_MAX", 61, SIM, vibe_motor, 0.0f), // minimum throttle for simulated ins noise diff --git a/libraries/SITL/SITL.h b/libraries/SITL/SITL.h index a0aa4f9f22..b2a39a3f87 100644 --- a/libraries/SITL/SITL.h +++ b/libraries/SITL/SITL.h @@ -337,6 +337,9 @@ public: // what harmonics to generate AP_Int16 vibe_motor_harmonics; + // what servos are motors + AP_Int32 vibe_motor_mask; + // minimum throttle for addition of ins noise AP_Float ins_noise_throttle_min;