Skip to content

Commit 1df1f0a

Browse files
randomsjihoonl
authored andcommitted
Set image streamer as inactive if topic is not available (#53)
* Resolves #38
1 parent 0933c6e commit 1df1f0a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/image_streamer.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ ImageTransportImageStreamer::ImageTransportImageStreamer(const async_web_server_
2424
void ImageTransportImageStreamer::start()
2525
{
2626
image_transport::TransportHints hints(default_transport_);
27+
ros::master::V_TopicInfo available_topics;
28+
ros::master::getTopics(available_topics);
29+
inactive_ = true;
30+
for (size_t it = 0; it<available_topics.size(); it++){
31+
if(available_topics[it].name == topic_){
32+
inactive_ = false;
33+
}
34+
}
2735
image_sub_ = it_.subscribe(topic_, 1, &ImageTransportImageStreamer::imageCallback, this, hints);
2836
}
2937

0 commit comments

Comments
 (0)