Skip to content

Commit

Permalink
add error handling to avoid crash when asic temperature monitor occas…
Browse files Browse the repository at this point in the history
…ionally fails
  • Loading branch information
gwen2018 committed Dec 14, 2023
1 parent 4679aa4 commit 573d6a7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions realsense2_camera/src/base_realsense_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1140,10 +1140,18 @@ void BaseRealSenseNode::startDiagnosticsUpdater()
{
for (rs2_option option : _monitor_options)
{
if (sensor->supports(option))
try
{
status.add(rs2_option_to_string(option), sensor->get_option(option));
got_temperature = true;
if (sensor->supports(option))
{
status.add(rs2_option_to_string(option), sensor->get_option(option));
got_temperature = true;
}
}
catch(const std::exception& ex)
{
got_temperature = false;
ROS_WARN_STREAM("An error has occurred during monitoring: " << ex.what());
}
}
if (got_temperature) break;
Expand Down

0 comments on commit 573d6a7

Please sign in to comment.