From e99a33c7e0cc777009730a977b2e4f4923f512fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Vallv=C3=A9=20Navarro?= <jvallve@iri.upc.edu> Date: Wed, 26 Jun 2019 13:31:50 +0200 Subject: [PATCH] adapted to new API --- include/gnss/processor/processor_gnss_fix.h | 33 +++++++++++++++++- .../processor/processor_gnss_single_diff.h | 34 ++++++++++++++++++- src/processor/processor_gnss_fix.cpp | 2 +- src/processor/processor_gnss_single_diff.cpp | 2 +- 4 files changed, 67 insertions(+), 4 deletions(-) diff --git a/include/gnss/processor/processor_gnss_fix.h b/include/gnss/processor/processor_gnss_fix.h index e6b3adfc8..f2f1d4a51 100644 --- a/include/gnss/processor/processor_gnss_fix.h +++ b/include/gnss/processor/processor_gnss_fix.h @@ -44,7 +44,33 @@ class ProcessorGnssFix : public ProcessorBase ProcessorGnssFix(ProcessorParamsGnssFixPtr _params, SensorGnssPtr _sensor_gnss_ptr); virtual ~ProcessorGnssFix(); virtual void configure(SensorBasePtr _sensor); - virtual void process(CaptureBasePtr _capture_ptr); + + protected: + /** \brief process an incoming capture + * + * Each derived processor should implement this function. It will be called if: + * - A new capture arrived and triggerInCapture() returned true. + */ + virtual void processCapture(CaptureBasePtr) override; + + /** \brief process an incoming key-frame + * + * The ProcessorTracker only processes incoming captures (it is not called). + */ + virtual void processKeyFrame(FrameBasePtr _keyframe_ptr, const Scalar& _time_tolerance) override {}; + + /** \brief trigger in capture + * + * Returns true if processCapture() should be called after the provided capture arrived. + */ + virtual bool triggerInCapture(CaptureBasePtr) override; + + /** \brief trigger in key-frame + * + * The ProcessorTracker only processes incoming captures, then it returns false. + */ + virtual bool triggerInKeyFrame(FrameBasePtr _keyframe_ptr, const Scalar& _time_tolerance) override {return false;} + virtual bool voteForKeyFrame(); private: @@ -56,6 +82,11 @@ class ProcessorGnssFix : public ProcessorBase }; +inline bool ProcessorGnssFix::triggerInCapture(CaptureBasePtr) +{ + return true; +} + } // namespace wolf #endif //WOLF_PROCESSOR_GNSS_FIX_H diff --git a/include/gnss/processor/processor_gnss_single_diff.h b/include/gnss/processor/processor_gnss_single_diff.h index 405caeb16..708b5c280 100644 --- a/include/gnss/processor/processor_gnss_single_diff.h +++ b/include/gnss/processor/processor_gnss_single_diff.h @@ -25,9 +25,36 @@ class ProcessorGnssSingleDiff : public ProcessorBase ProcessorGnssSingleDiff(ProcessorParamsBasePtr _params, SensorGnssPtr _sensor_gnss_ptr); virtual ~ProcessorGnssSingleDiff(); virtual void configure(SensorBasePtr _sensor); - virtual void process(CaptureBasePtr _capture_ptr); + + protected: + /** \brief process an incoming capture + * + * Each derived processor should implement this function. It will be called if: + * - A new capture arrived and triggerInCapture() returned true. + */ + virtual void processCapture(CaptureBasePtr) override; + + /** \brief process an incoming key-frame + * + * The ProcessorTracker only processes incoming captures (it is not called). + */ + virtual void processKeyFrame(FrameBasePtr _keyframe_ptr, const Scalar& _time_tolerance) override {}; + + /** \brief trigger in capture + * + * Returns true if processCapture() should be called after the provided capture arrived. + */ + virtual bool triggerInCapture(CaptureBasePtr) override; + + /** \brief trigger in key-frame + * + * The ProcessorTracker only processes incoming captures, then it returns false. + */ + virtual bool triggerInKeyFrame(FrameBasePtr _keyframe_ptr, const Scalar& _time_tolerance) override {return false;} + virtual bool voteForKeyFrame(); + private: FactorBasePtr emplaceFactor(FeatureBasePtr& ftr_ptr); @@ -36,6 +63,11 @@ class ProcessorGnssSingleDiff : public ProcessorBase }; +inline bool ProcessorGnssSingleDiff::triggerInCapture(CaptureBasePtr) +{ + return true; +} + } // namespace wolf #endif //WOLF_PROCESSOR_GNSS_SINGLE_DIFF_H diff --git a/src/processor/processor_gnss_fix.cpp b/src/processor/processor_gnss_fix.cpp index 82a23ec2d..68becb54e 100644 --- a/src/processor/processor_gnss_fix.cpp +++ b/src/processor/processor_gnss_fix.cpp @@ -21,7 +21,7 @@ ProcessorGnssFix::~ProcessorGnssFix() // } -void ProcessorGnssFix::process(CaptureBasePtr _capture_ptr) +void ProcessorGnssFix::processCapture(CaptureBasePtr _capture_ptr) { // TODO: keep captures in a buffer and deal with KFpacks diff --git a/src/processor/processor_gnss_single_diff.cpp b/src/processor/processor_gnss_single_diff.cpp index 6fdecea33..42b246c6c 100644 --- a/src/processor/processor_gnss_single_diff.cpp +++ b/src/processor/processor_gnss_single_diff.cpp @@ -19,7 +19,7 @@ ProcessorGnssSingleDiff::~ProcessorGnssSingleDiff() // } -void ProcessorGnssSingleDiff::process(CaptureBasePtr _capture_ptr) +void ProcessorGnssSingleDiff::processCapture(CaptureBasePtr _capture_ptr) { // TODO: keep captures in a buffer and deal with KFpacks -- GitLab