Skip to content

Commit

Permalink
Fix linters and address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Emerson Knapp <emerson.b.knapp@gmail.com>
  • Loading branch information
emersonknapp committed Dec 2, 2021
1 parent 200ae66 commit 2ce7cc9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions rosbag2_transport/include/rosbag2_transport/bag_rewrite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ namespace rosbag2_transport
/// - compress
/// - serialization format conversion
///
/// Note: If a serialization format is not specified for an output bag's RecordOptions,
/// any topic going into it will use the serialization format of the last input with that topic.
///
/// \param input_options vector of settings to create Readers for bags to read messages from
/// \param output_bags - full "recording" configuration of the bag(s) to write messages to
/// Each output bag will be passed messages from every input bag,
Expand Down
1 change: 1 addition & 0 deletions rosbag2_transport/src/rosbag2_transport/bag_rewrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace
/// Find the next chronological message from all opened input bags.
/// Updates the next_messages queue as necessary.
/// next_messages is needed because Reader has no "peek" interface, we cannot put a message back.
/// Returns nullptr when all input bags have been fully read.
std::shared_ptr<rosbag2_storage::SerializedBagMessage> get_next(
const std::vector<std::unique_ptr<rosbag2_cpp::Reader>> & input_bags,
std::vector<std::shared_ptr<rosbag2_storage::SerializedBagMessage>> & next_messages)
Expand Down
3 changes: 2 additions & 1 deletion rosbag2_transport/src/rosbag2_transport/topic_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ bool TopicFilter::take_topic(
return false;
}

if (record_options_.ignore_leaf_topics && is_leaf_topic(topic_name, *node_graph_)) {
if (record_options_.ignore_leaf_topics && node_graph_ && is_leaf_topic(topic_name, *node_graph_))
{
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion rosbag2_transport/src/rosbag2_transport/topic_filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ROSBAG2_TRANSPORT_PUBLIC TopicFilter
public:
explicit TopicFilter(
RecordOptions record_options,
rclcpp::node_interfaces::NodeGraphInterface::SharedPtr node_graph,
rclcpp::node_interfaces::NodeGraphInterface::SharedPtr node_graph = nullptr,
bool allow_unknown_types = false);
virtual ~TopicFilter();

Expand Down
6 changes: 5 additions & 1 deletion rosbag2_transport/test/rosbag2_transport/test_rewrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

#include <gmock/gmock.h>

#include <string>
#include <vector>
#include <utility>

#include "rcpputils/filesystem_helper.hpp"
#include "rosbag2_transport/bag_rewrite.hpp"
#include "rosbag2_transport/reader_writer_factory.hpp"
Expand Down Expand Up @@ -72,7 +76,7 @@ class TestRewrite : public Test
const rcpputils::fs::path output_dir_;
std::vector<rosbag2_storage::StorageOptions> input_bags_;
std::vector<std::pair<rosbag2_storage::StorageOptions, rosbag2_transport::RecordOptions>>
output_bags_;
output_bags_;
};

TEST_F(TestRewrite, test_noop_rewrite) {
Expand Down

0 comments on commit 2ce7cc9

Please sign in to comment.