From 073f10fe4f119c115a503d62a596f0f89183ce8b Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 24 May 2015 11:46:25 +0200 Subject: [PATCH] Land detector: Better docs and status feedback --- src/modules/land_detector/LandDetector.h | 19 ++++++++++++------- .../land_detector/land_detector_main.cpp | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/modules/land_detector/LandDetector.h b/src/modules/land_detector/LandDetector.h index 09db6e4746..b2984003b9 100644 --- a/src/modules/land_detector/LandDetector.h +++ b/src/modules/land_detector/LandDetector.h @@ -52,19 +52,24 @@ public: virtual ~LandDetector(); /** - * @return true if this task is currently running - **/ + * @return true if this task is currently running + **/ inline bool isRunning() const {return _taskIsRunning;} /** - * @brief Tells the Land Detector task that it should exit - **/ + * @return the current landed state + */ + bool isLanded() { return _landDetected.landed; } + + /** + * @brief Tells the Land Detector task that it should exit + **/ void shutdown(); /** - * @brief Blocking function that should be called from it's own task thread. This method will - * run the underlying algorithm at the desired update rate and publish if the landing state changes. - **/ + * @brief Blocking function that should be called from it's own task thread. This method will + * run the underlying algorithm at the desired update rate and publish if the landing state changes. + **/ void start(); protected: diff --git a/src/modules/land_detector/land_detector_main.cpp b/src/modules/land_detector/land_detector_main.cpp index b4b7c33a20..c3829bb70d 100644 --- a/src/modules/land_detector/land_detector_main.cpp +++ b/src/modules/land_detector/land_detector_main.cpp @@ -195,7 +195,7 @@ int land_detector_main(int argc, char *argv[]) if (land_detector_task) { if (land_detector_task->isRunning()) { - warnx("running (%s)", _currentMode); + warnx("running (%s): %s", _currentMode, (land_detector_task->isLanded()) ? "LANDED" : "IN AIR"); } else { errx(1, "exists, but not running (%s)", _currentMode);