Code Monkey home page Code Monkey logo

Comments (2)

trainman419 avatar trainman419 commented on June 7, 2024

The documentation isn't clear on this, but the discard_stale parameter requires at least one diagnostic item within that category to be considered non-stale. This allows individual items to come and go, but to still report stale if the entire category is missing.

The code that implements this is:

bool all_stale = true;
std::map<std::string, boost::shared_ptr<StatusItem> >::iterator it = items_.begin();
while(it != items_.end())
{
std::string name = it->first;
boost::shared_ptr<StatusItem> item = it->second;
bool stale = false;
if (timeout_ > 0)
stale = (ros::Time::now() - item->getLastUpdateTime()).toSec() > timeout_;
// Erase item if its stale and we're discarding items
if (discard_stale_ and stale)
{
items_.erase(it++);
continue;
}
int8_t level = item->getLevel();
header_status->level = std::max(header_status->level, level);
diagnostic_msgs::KeyValue kv;
kv.key = name;
kv.value = item->getMessage();
header_status->values.push_back(kv);
all_stale = all_stale && ((level == 3) || stale);
//boost::shared_ptr<diagnostic_msgs::DiagnosticStatus> stat = item->toStatusMsg(path_, stale);
processed.push_back(item->toStatusMsg(path_, stale));
if (stale)
header_status->level = 3;
++it;
}
// Header is not stale unless all subs are
if (all_stale)
header_status->level = 3;
else if (header_status->level == 3)
header_status->level = 2;

from diagnostics.

pirobot avatar pirobot commented on June 7, 2024

OK, I get it now. Thanks!

from diagnostics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.