From 47b79eb72d791f53d6e914da0ebc51b44a564b7c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 2 May 2017 19:35:57 +1000 Subject: [PATCH] SITL: expose home location --- libraries/SITL/SIM_Aircraft.cpp | 4 ++++ libraries/SITL/SITL.h | 1 + 2 files changed, 5 insertions(+) diff --git a/libraries/SITL/SIM_Aircraft.cpp b/libraries/SITL/SIM_Aircraft.cpp index e422e97f4550f2..b7d608dc4b971f 100644 --- a/libraries/SITL/SIM_Aircraft.cpp +++ b/libraries/SITL/SIM_Aircraft.cpp @@ -330,6 +330,10 @@ void Aircraft::fill_fdm(struct sitl_fdm &fdm) smooth_sensors(); } fdm.timestamp_us = time_now_us; + if (fdm.home.lat == 0 && fdm.home.lng == 0) { + // initialise home + fdm.home = home; + } fdm.latitude = location.lat * 1.0e-7; fdm.longitude = location.lng * 1.0e-7; fdm.altitude = location.alt * 1.0e-2; diff --git a/libraries/SITL/SITL.h b/libraries/SITL/SITL.h index d6e7ae73f65022..648b87ab89580e 100644 --- a/libraries/SITL/SITL.h +++ b/libraries/SITL/SITL.h @@ -9,6 +9,7 @@ namespace SITL { struct sitl_fdm { // this is the structure passed between FDM models and the main SITL code uint64_t timestamp_us; + Location home; double latitude, longitude; // degrees double altitude; // MSL double heading; // degrees