Skip to content

Commit

Permalink
fix(metrics): fix std::stod exception
Browse files Browse the repository at this point in the history
Signed-off-by: satoshi-ota <[email protected]>
  • Loading branch information
satoshi-ota committed Aug 26, 2024
1 parent fb68ea4 commit 53fafc6
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,16 @@ struct Metric
void updateData(const double time, const DiagnosticStatus & status)
{
for (const auto & [key, value] : status.values) {
const double data = std::stod(value);
labels.at(key)->setText(QString::fromStdString(toString(data)));
plots.at(key)->append(time, data);
updateMinMax(data);
try {
const double data = std::stod(value);
labels.at(key)->setText(QString::fromStdString(toString(data)));
plots.at(key)->append(time, data);
updateMinMax(data);
} catch (const std::exception & e) {
RCLCPP_DEBUG(
rclcpp::get_logger(__func__), "%s invalid argument. KEY:%s VALUE:%s", e.what(),
key.c_str(), value.c_str());
}
}

{
Expand Down

0 comments on commit 53fafc6

Please sign in to comment.