@@ -40,8 +40,7 @@ const std::vector<const char*>& DataLoadROS2::compatibleFileExtensions() const
4040 return _extensions;
4141}
4242
43- bool DataLoadROS2::readDataFromFile (PJ::FileLoadInfo* info,
44- PJ::PlotDataMapRef& plot_map)
43+ bool DataLoadROS2::readDataFromFile (PJ::FileLoadInfo* info, PJ::PlotDataMapRef& plot_map)
4544{
4645 auto metadata_io = std::make_unique<rosbag2_storage::MetadataIo>();
4746
@@ -71,14 +70,17 @@ bool DataLoadROS2::readDataFromFile(PJ::FileLoadInfo* info,
7170 }
7271 catch (std::runtime_error& ex)
7372 {
74- QMessageBox::warning (nullptr , tr (" Error" ), QString (" rosbag::open thrown an exception:\n " ) + QString (ex.what ()));
73+ QMessageBox::warning (nullptr , tr (" Error" ),
74+ QString (" rosbag::open thrown an exception:\n " ) + QString (ex.what ()));
7575 return false ;
7676 }
7777
7878 QDir::setCurrent (oldPath);
7979
80- // Temporarily change the current directory as a workaround for rosbag2 relative directories not working properly
81- std::vector<rosbag2_storage::TopicMetadata> topic_metadata = temp_bag_reader->get_all_topics_and_types ();
80+ // Temporarily change the current directory as a workaround for rosbag2 relative directories not
81+ // working properly
82+ std::vector<rosbag2_storage::TopicMetadata> topic_metadata =
83+ temp_bag_reader->get_all_topics_and_types ();
8284
8385 std::unordered_map<std::string, std::string> topicTypesByName;
8486
@@ -91,25 +93,27 @@ bool DataLoadROS2::readDataFromFile(PJ::FileLoadInfo* info,
9193
9294 for (const rosbag2_storage::TopicMetadata& topic : topic_metadata)
9395 {
94- all_topics_qt.push_back ( { QString::fromStdString (topic. name ),
95- QString::fromStdString (topic.type )} );
96+ all_topics_qt.push_back (
97+ { QString::fromStdString (topic. name ), QString::fromStdString (topic.type ) } );
9698 topicTypesByName.emplace (topic.name , topic.type );
9799
98100 const auto & typesupport_identifier = rosidl_typesupport_cpp::typesupport_identifier;
99101 try
100102 {
101- topics_info.emplace_back ( CreateTopicInfo (topic.name , topic.type ) );
102-
103- } catch (...) {
103+ topics_info.emplace_back (CreateTopicInfo (topic.name , topic.type ));
104+ }
105+ catch (...)
106+ {
104107 failed_topic_type.insert (topic.type );
105108 blacklist_topic_name.insert (topic.type );
106109 }
107110 }
108111
109- if (!failed_topic_type.empty ())
112+ if (!failed_topic_type.empty ())
110113 {
111- QString msg (" Can not recognize the following message types and those topics will be ignored:\n\n " );
112- for (const auto & type: failed_topic_type)
114+ QString msg (
115+ " Can not recognize the following message types and those topics will be ignored:\n\n " );
116+ for (const auto & type : failed_topic_type)
113117 {
114118 msg += " " + QString::fromStdString (type) + " \n " ;
115119 }
@@ -159,10 +163,8 @@ bool DataLoadROS2::readDataFromFile(PJ::FileLoadInfo* info,
159163 std::string topic_type = topicTypesByName.at (topic_name);
160164 topic_selected.insert (topic_name);
161165
162- auto ros2_parser = CreateParserROS2 ( *parserFactories (),
163- topic_name, topic_type, plot_map);
166+ auto ros2_parser = CreateParserROS2 (*parserFactories (), topic_name, topic_type, plot_map);
164167 parser.addParser (topic_name, ros2_parser);
165-
166168 }
167169
168170 parser.setConfig (_config);
@@ -181,15 +183,15 @@ bool DataLoadROS2::readDataFromFile(PJ::FileLoadInfo* info,
181183 plot_map.addUserDefined (" plotjuggler::rosbag2_cpp::topics_metadata" )->second ;
182184
183185 // dirty trick. Store it in a one point timeseries
184- metadata_storage.pushBack ( { 0 , std::any (topics_info) } );
186+ metadata_storage.pushBack ({ 0 , std::any (topics_info) });
185187
186188 auto time_prev = std::chrono::high_resolution_clock::now ();
187189
188190 while (_bag_reader->has_next ())
189191 {
190192 auto msg = _bag_reader->read_next ();
191193 const std::string& topic_name = msg->topic_name ;
192- if (blacklist_topic_name.count (topic_name))
194+ if (blacklist_topic_name.count (topic_name))
193195 {
194196 continue ;
195197 }
0 commit comments