From d24088794b45b29824994248123e2e002868ba1b Mon Sep 17 00:00:00 2001 From: Ugo Pattacini Date: Tue, 16 Nov 2021 15:36:49 +0100 Subject: [PATCH] Add board info to the downsampler --- src/libraries/icubmod/embObjLib/mcEventDownsampler.cpp | 4 ++-- src/libraries/icubmod/embObjLib/mcEventDownsampler.h | 8 +++----- .../icubmod/embObjMotionControl/embObjMotionControl.cpp | 3 ++- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/libraries/icubmod/embObjLib/mcEventDownsampler.cpp b/src/libraries/icubmod/embObjLib/mcEventDownsampler.cpp index e89e95ca6b..7cf0efa562 100644 --- a/src/libraries/icubmod/embObjLib/mcEventDownsampler.cpp +++ b/src/libraries/icubmod/embObjLib/mcEventDownsampler.cpp @@ -61,7 +61,7 @@ namespace mced { return false; } - bool mcEventDownsampler::start(const Config &config) + bool mcEventDownsampler::start() { if(nullptr != timer) { @@ -103,7 +103,7 @@ namespace mced { void mcEventDownsampler::printreport() { - yCError(MC_EVENT_DOWNSAMPLER) << "Detected " << counter - latch_2 << " events on aggregate since the last message"; + yCError(MC_EVENT_DOWNSAMPLER) << info << "detected" << counter - latch_2 << "events on aggregate since the last message"; } } // mced diff --git a/src/libraries/icubmod/embObjLib/mcEventDownsampler.h b/src/libraries/icubmod/embObjLib/mcEventDownsampler.h index 23c91b92e3..b930d95b63 100644 --- a/src/libraries/icubmod/embObjLib/mcEventDownsampler.h +++ b/src/libraries/icubmod/embObjLib/mcEventDownsampler.h @@ -24,10 +24,8 @@ namespace mced { */ struct Config { - double period {0.}; - Config() = default; - constexpr Config(double c) : period(c) {} - bool isvalid() const { return 0. != period; } + double period {.01}; + std::string info {""}; }; /** @@ -61,7 +59,7 @@ namespace mced { * @return true if the difference is lower or equal to the threshold, false if it is higher. */ bool canprint(); - Config config = 0.1; + Config config; private: /** diff --git a/src/libraries/icubmod/embObjMotionControl/embObjMotionControl.cpp b/src/libraries/icubmod/embObjMotionControl/embObjMotionControl.cpp index f7740612da..003073a601 100644 --- a/src/libraries/icubmod/embObjMotionControl/embObjMotionControl.cpp +++ b/src/libraries/icubmod/embObjMotionControl/embObjMotionControl.cpp @@ -403,7 +403,8 @@ bool embObjMotionControl::open(yarp::os::Searchable &config) event_downsampler = new mced::mcEventDownsampler(); event_downsampler->config.period = 0.01; - event_downsampler->start(event_downsampler->config); + event_downsampler->config.info = getBoardInfo(); + event_downsampler->start(); if(false == res->serviceVerifyActivate(eomn_serv_category_mc, servparam)) {