diff --git a/libraries/AP_HAL_SITL/SITL_State_common.cpp b/libraries/AP_HAL_SITL/SITL_State_common.cpp index b4f96e4cf4..de94ee6590 100644 --- a/libraries/AP_HAL_SITL/SITL_State_common.cpp +++ b/libraries/AP_HAL_SITL/SITL_State_common.cpp @@ -52,6 +52,12 @@ SITL::SerialDevice *SITL_State_Common::create_serial_sim(const char *name, const sitl_model->set_adsb(adsb); return adsb; #endif + } else if (streq(name, "ainsteinlrd1")) { + if (ainsteinlrd1 != nullptr) { + AP_HAL::panic("Only one ainsteinlrd1 at a time"); + } + ainsteinlrd1 = new SITL::RF_Ainstein_LR_D1(); + return ainsteinlrd1; } else if (streq(name, "benewake_tf03")) { if (benewake_tf03 != nullptr) { AP_HAL::panic("Only one benewake_tf03 at a time"); @@ -338,6 +344,9 @@ void SITL_State_Common::sim_update(void) attitude); } #endif + if (ainsteinlrd1 != nullptr) { + ainsteinlrd1->update(sitl_model->rangefinder_range()); + } if (benewake_tf02 != nullptr) { benewake_tf02->update(sitl_model->rangefinder_range()); } diff --git a/libraries/AP_HAL_SITL/SITL_State_common.h b/libraries/AP_HAL_SITL/SITL_State_common.h index 82c281e305..19e7356c3b 100644 --- a/libraries/AP_HAL_SITL/SITL_State_common.h +++ b/libraries/AP_HAL_SITL/SITL_State_common.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -122,6 +123,8 @@ public: SITL::Vicon *vicon; #endif + // simulated Ainstein LR-D1 rangefinder: + SITL::RF_Ainstein_LR_D1 *ainsteinlrd1; // simulated Benewake tf02 rangefinder: SITL::RF_Benewake_TF02 *benewake_tf02; // simulated Benewake tf03 rangefinder: