From 22261553bbf54d34a62d1d65fc4895d96b8a30c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Or=C5=A1uli=C4=87?= Date: Wed, 28 Feb 2018 11:51:17 +0100 Subject: [PATCH] Offline multi-trajectory: use topic names without 'bag_n_' prefix by default (#707) This fixes offline_backpack_*.launch for multiple bags. --- .../cartographer_ros/offline_node.cc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/cartographer_ros/cartographer_ros/offline_node.cc b/cartographer_ros/cartographer_ros/offline_node.cc index 8b8d08f..96f1c53 100644 --- a/cartographer_ros/cartographer_ros/offline_node.cc +++ b/cartographer_ros/cartographer_ros/offline_node.cc @@ -156,8 +156,21 @@ void RunOfflineNode(const MapBuilderFactory& map_builder_factory) { }, false /* oneshot */, false /* autostart */); - auto bag_expected_sensor_ids = - node.ComputeDefaultSensorIdsForMultipleBags(bag_trajectory_options); + std::vector< + std::set> + bag_expected_sensor_ids; + if (configuration_basenames.size() == 1) { + const auto current_bag_expected_sensor_ids = + node.ComputeDefaultSensorIdsForMultipleBags( + {bag_trajectory_options.front()}); + bag_expected_sensor_ids = {bag_filenames.size(), + current_bag_expected_sensor_ids.front()}; + } else { + bag_expected_sensor_ids = + node.ComputeDefaultSensorIdsForMultipleBags(bag_trajectory_options); + } + CHECK_EQ(bag_expected_sensor_ids.size(), bag_filenames.size()); + std::map, cartographer::mapping::TrajectoryBuilderInterface::SensorId> bag_topic_to_sensor_id;