Skip to content

Commit

Permalink
cmd_play: basic topic information in status message
Browse files Browse the repository at this point in the history
  • Loading branch information
xqms committed Feb 19, 2024
1 parent ce04faa commit 70441ca
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 24 deletions.
34 changes: 11 additions & 23 deletions rosbag_fancy/src/cmd_play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,32 +237,20 @@ int play(const std::vector<std::string>& options)
msg->current = currentTime-startTime;
msg->duration = endTime-startTime;

for(const auto & bag : bags)
msg->bagfiles.reserve(bags.size());
for(const auto& bag : bags)
msg->bagfiles.emplace_back(bag.filename_);

msg->topics.reserve(topicManager.topics().size());
for(const auto& topic : topicManager.topics())
{
msg->topics.emplace_back();
auto& topicMsg = msg->topics.back();

// TODO: fill some of this information

// auto& counts = writer.messageCounts();

// for(auto& topic : topicManager.topics())
// {
// msg->topics.emplace_back();
// auto& topicMsg = msg->topics.back();

// msg->bandwidth += topic.bandwidth;

// topicMsg.name = topic.name;
// topicMsg.publishers = topic.numPublishers;
// topicMsg.bandwidth = topic.bandwidth;
// topicMsg.bytes = topic.totalBytes;
// topicMsg.messages = topic.totalMessages;

// if(topic.id < counts.size())
// topicMsg.messages_in_current_bag = counts[topic.id];

// topicMsg.rate = topic.messageRateAt(now);
// }
topicMsg.name = topic.name;
topicMsg.bandwidth = topic.bandwidth;
topicMsg.rate = topic.messageRate;
}

pub_status.publish(msg);
}));
Expand Down
1 change: 1 addition & 0 deletions rosbag_fancy_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ add_message_files(FILES
Status.msg
TopicStatus.msg
PlayStatus.msg
PlayTopicStatus.msg
)

generate_messages(DEPENDENCIES
Expand Down
2 changes: 1 addition & 1 deletion rosbag_fancy_msgs/msg/PlayStatus.msg
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ time startTime
time endTime
string[] bagfiles

TopicStatus[] topics
PlayTopicStatus[] topics

5 changes: 5 additions & 0 deletions rosbag_fancy_msgs/msg/PlayTopicStatus.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

string name

float32 rate
float32 bandwidth

0 comments on commit 70441ca

Please sign in to comment.