Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asynchronous stream frequency diagnostics #1471

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Publish diagnostics update asynchronously
  • Loading branch information
kubja committed Oct 28, 2020
commit a7c2cebde9b2ea83f131bcb8fbda59b1f4b6f08e
1 change: 1 addition & 0 deletions realsense2_camera/include/base_realsense_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ namespace realsense2_camera
rs2_stream rs2_string_to_stream(std::string str);
void startMonitoring();
void publish_temperature();
void publish_frequency_update();

rs2::device _dev;
std::map<stream_index_pair, rs2::sensor> _sensors;
Expand Down
11 changes: 10 additions & 1 deletion realsense2_camera/src/base_realsense_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2322,7 +2322,7 @@ void BaseRealSenseNode::startMonitoring()
_temperature_nodes.push_back({option, std::make_shared<TemperatureDiagnostics>(rs2_option_to_string(option), _serial_no )});
}

int time_interval(10000);
int time_interval(1000);
std::function<void()> func = [this, time_interval](){
std::mutex mu;
std::unique_lock<std::mutex> lock(mu);
Expand All @@ -2331,6 +2331,7 @@ void BaseRealSenseNode::startMonitoring()
if (_is_running)
{
publish_temperature();
publish_frequency_update();
}
}
};
Expand Down Expand Up @@ -2358,6 +2359,14 @@ void BaseRealSenseNode::publish_temperature()
}
}

void BaseRealSenseNode::publish_frequency_update()
{
for (auto &image_publisher : _image_publishers)
{
image_publisher.second.second->update();
}
}

TemperatureDiagnostics::TemperatureDiagnostics(std::string name, std::string serial_no)
{
_updater.add(name, this, &TemperatureDiagnostics::diagnostics);
Expand Down