From acf1a418c11708c48d1e9b13a6d11c08e27a702b Mon Sep 17 00:00:00 2001 From: ymd-stella <7959916+ymd-stella@users.noreply.github.com> Date: Sun, 17 Dec 2023 10:37:52 +0900 Subject: [PATCH] Changed get_tracking_state to return a string (#548) --- src/stella_vslam/publish/frame_publisher.cc | 14 ++++++++++++-- src/stella_vslam/publish/frame_publisher.h | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/stella_vslam/publish/frame_publisher.cc b/src/stella_vslam/publish/frame_publisher.cc index ed081ac6..f2d459ba 100644 --- a/src/stella_vslam/publish/frame_publisher.cc +++ b/src/stella_vslam/publish/frame_publisher.cc @@ -73,9 +73,19 @@ cv::Mat frame_publisher::draw_frame() { return img; } -tracker_state_t frame_publisher::get_tracking_state() { +std::string frame_publisher::get_tracking_state() { std::lock_guard lock(mtx_); - return tracking_state_; + std::string state_str; + if (tracking_state_ == tracker_state_t::Initializing) { + state_str = "Initializing"; + } + else if (tracking_state_ == tracker_state_t::Lost) { + state_str = "Lost"; + } + else if (tracking_state_ == tracker_state_t::Tracking) { + state_str = "Tracking"; + } + return state_str; } std::vector frame_publisher::get_keypoints() { diff --git a/src/stella_vslam/publish/frame_publisher.h b/src/stella_vslam/publish/frame_publisher.h index 429323d6..b4c2e447 100644 --- a/src/stella_vslam/publish/frame_publisher.h +++ b/src/stella_vslam/publish/frame_publisher.h @@ -51,7 +51,7 @@ class frame_publisher { */ cv::Mat draw_frame(); - tracker_state_t get_tracking_state(); + std::string get_tracking_state(); std::vector get_keypoints();