diff --git a/libraries/AP_HAL_SITL/SITL_State_common.cpp b/libraries/AP_HAL_SITL/SITL_State_common.cpp index 89288310ea..395c66b1be 100644 --- a/libraries/AP_HAL_SITL/SITL_State_common.cpp +++ b/libraries/AP_HAL_SITL/SITL_State_common.cpp @@ -49,6 +49,7 @@ SITL::SerialDevice *SITL_State_Common::create_serial_sim(const char *name, const if (adsb == nullptr) { adsb = new SITL::ADSB(); } + sitl_model->set_adsb(adsb); return adsb; #endif } else if (streq(name, "benewake_tf03")) { @@ -209,6 +210,14 @@ SITL::SerialDevice *SITL_State_Common::create_serial_sim(const char *name, const sf45b = new SITL::PS_LightWare_SF45B(); return sf45b; #endif +#if AP_SIM_ADSB_SAGETECH_MXS_ENABLED + } else if (streq(name, "sagetech_mxs")) { + if (sagetech_mxs != nullptr) { + AP_HAL::panic("Only one sagetech_mxs at a time"); + } + sagetech_mxs = new SITL::ADSB_Sagetech_MXS(); + return sagetech_mxs; +#endif #if !defined(HAL_BUILD_AP_PERIPH) } else if (streq(name, "richenpower")) { sitl_model->set_richenpower(&_sitl->richenpower_sim); @@ -390,6 +399,12 @@ void SITL_State_Common::sim_update(void) } #endif +#if AP_SIM_ADSB_SAGETECH_MXS_ENABLED + if (sagetech_mxs != nullptr) { + sagetech_mxs->update(sitl_model); + } +#endif + if (vectornav != nullptr) { vectornav->update(); } diff --git a/libraries/AP_HAL_SITL/SITL_State_common.h b/libraries/AP_HAL_SITL/SITL_State_common.h index b1105ecc35..dab0cb0e5a 100644 --- a/libraries/AP_HAL_SITL/SITL_State_common.h +++ b/libraries/AP_HAL_SITL/SITL_State_common.h @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -112,6 +113,10 @@ public: SITL::ADSB *adsb; #endif +#if AP_SIM_ADSB_SAGETECH_MXS_ENABLED + SITL::ADSB_Sagetech_MXS *sagetech_mxs; +#endif + #if !defined(HAL_BUILD_AP_PERIPH) // simulated vicon system: SITL::Vicon *vicon;