From bf229b3dc1bc14be63684f7874370be66184d1c6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 29 Sep 2023 14:11:22 +1000 Subject: [PATCH] HAL_SITL: enable ADSB simulator in SITL periph --- libraries/AP_HAL_SITL/SITL_Periph_State.cpp | 6 ++++++ libraries/AP_HAL_SITL/SITL_Periph_State.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/AP_HAL_SITL/SITL_Periph_State.cpp b/libraries/AP_HAL_SITL/SITL_Periph_State.cpp index a4bf8cfa1c..4d2cb796a0 100644 --- a/libraries/AP_HAL_SITL/SITL_Periph_State.cpp +++ b/libraries/AP_HAL_SITL/SITL_Periph_State.cpp @@ -270,6 +270,12 @@ void SimMCast::multicast_read(void) base_time_us += (_sitl->state.timestamp_us - state.timestamp_us); } _sitl->state = state; + location.lat = state.latitude*1.0e7; + location.lng = state.longitude*1.0e7; + location.alt = state.altitude*1.0e2; + if (home.is_zero()) { + home = location; + } hal.scheduler->stop_clock(_sitl->state.timestamp_us + base_time_us); HALSITL::Scheduler::timer_event(); if (servo_fd == -1) { diff --git a/libraries/AP_HAL_SITL/SITL_Periph_State.h b/libraries/AP_HAL_SITL/SITL_Periph_State.h index e519c84c53..0aca46d29b 100644 --- a/libraries/AP_HAL_SITL/SITL_Periph_State.h +++ b/libraries/AP_HAL_SITL/SITL_Periph_State.h @@ -66,7 +66,7 @@ public: "none:0", "GPS1", "none:1", - "none:2", + "sim:adsb", "none:3", "none:4", "none:5",