Skip to content

Commit

Permalink
Add board info to the downsampler (#771)
Browse files Browse the repository at this point in the history
  • Loading branch information
pattacini authored Nov 16, 2021
1 parent dc81e0f commit e193e2d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/libraries/icubmod/embObjLib/mcEventDownsampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace mced {
return false;
}

bool mcEventDownsampler::start(const Config &config)
bool mcEventDownsampler::start()
{
if(nullptr != timer)
{
Expand Down Expand Up @@ -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) << config.info << "detected" << counter - latch_2 << "events on aggregate since the last message";
}

} // mced
11 changes: 4 additions & 7 deletions src/libraries/icubmod/embObjLib/mcEventDownsampler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {""};
};

/**
Expand All @@ -44,10 +42,9 @@ namespace mced {

/**
* @brief Instantiates the yarp::os::Timer object and starts it.
* @param config Structure containing the configuration parameters of the Event Downsampler
* @return true if the instantiation was successful, false otherwise.
*/
bool start(const Config &config);
bool start();

/**
* @brief Stops the timer
Expand All @@ -61,7 +58,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:
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down

0 comments on commit e193e2d

Please sign in to comment.