Skip to content

Commit

Permalink
Fixed all linter errors. (Change Request ros2#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldube committed May 6, 2019
1 parent c7a885a commit ec055cb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions rosbag2_transport/include/rosbag2_transport/play_options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ namespace rosbag2_transport
struct PlayOptions
{
public:
using TopicFilter = std::function<bool(const std::string& topic)>;
using TopicFilter = std::function<bool (const std::string & topic)>;

size_t read_ahead_queue_size;
std::string node_prefix = "";
TopicFilter topic_filter = [](const std::string&){return false;};
TopicFilter topic_filter = [](const std::string &) {return false;};
};

} // namespace rosbag2_transport
Expand Down
6 changes: 3 additions & 3 deletions rosbag2_transport/src/rosbag2_transport/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ void Player::play_messages_until_queue_empty(const PlayOptions & options)
{
ReplayableMessage message;
while (message_queue_.try_dequeue(message) && rclcpp::ok()) {
if (options.topic_filter(message.message->topic_name))
if (options.topic_filter(message.message->topic_name)) {
continue;
}
std::this_thread::sleep_until(start_time_ + message.time_since_start);
if (rclcpp::ok()) {
publishers_[message.message->topic_name]->publish(message.message->serialized_data);
Expand All @@ -144,8 +145,7 @@ void Player::prepare_publishers(const PlayOptions & options)
auto topics = reader_->get_all_topics_and_types();

for (const auto & topic : topics) {
if (options.topic_filter(topic.name))
{
if (options.topic_filter(topic.name)) {
ROSBAG2_TRANSPORT_LOG_INFO("Excluding topic %s", topic.name.c_str());
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,14 @@ rosbag2_transport_play(PyObject * Py_UNUSED(self), PyObject * args, PyObject * k
}

if (exclude_topics_list.empty() == false) {
auto topic_filter_function = [exclude_topics_list](const std::string& topic)
{
auto entry = exclude_topics_list.find(topic);
if (entry == exclude_topics_list.end())
return false;
return true;
};
auto topic_filter_function = [exclude_topics_list](const std::string & topic)
{
auto entry = exclude_topics_list.find(topic);
if (entry == exclude_topics_list.end()) {
return false;
}
return true;
};

play_options.topic_filter = topic_filter_function;
}
Expand Down

0 comments on commit ec055cb

Please sign in to comment.