@@ -38,15 +38,21 @@ RosbagDataProvider::RosbagDataProvider(const VioParams& vio_params)
3838 k_last_kf_(0u ),
3939 k_last_imu_(0u ),
4040 k_last_gt_(0u ) {
41- LOG (INFO) << " Starting Kimera-VIO wrapper offline mode." ;
42-
4341 CHECK (nh_private_.getParam (" rosbag_path" , rosbag_path_));
4442 CHECK (nh_private_.getParam (" left_cam_rosbag_topic" , left_imgs_topic_));
4543 CHECK (nh_private_.getParam (" right_cam_rosbag_topic" , right_imgs_topic_));
4644 CHECK (nh_private_.getParam (" imu_rosbag_topic" , imu_topic_));
4745 CHECK (nh_private_.getParam (" ground_truth_odometry_rosbag_topic" ,
4846 gt_odom_topic_));
4947
48+ LOG (INFO) << " Constructing RosbagDataProvider from path: \n "
49+ << " - Rosbag Path: " << rosbag_path_.c_str () << ' \n '
50+ << " With ROS topics: \n "
51+ << " - Left cam: " << left_imgs_topic_.c_str () << ' \n '
52+ << " - Right cam: " << right_imgs_topic_.c_str () << ' \n '
53+ << " - IMU: " << imu_topic_.c_str () << ' \n '
54+ << " - GT odom: " << gt_odom_topic_.c_str ();
55+
5056 CHECK (!rosbag_path_.empty ());
5157 CHECK (!left_imgs_topic_.empty ());
5258 CHECK (!right_imgs_topic_.empty ());
@@ -71,6 +77,7 @@ RosbagDataProvider::RosbagDataProvider(const VioParams& vio_params)
7177bool RosbagDataProvider::spin () {
7278 if (k_ == 0 ) {
7379 // Initialize!
80+ LOG (INFO) << " Initialize Rosbag Data Provider." ;
7481 // Parse data from rosbag first thing:
7582 CHECK (parseRosbag (rosbag_path_, &rosbag_data_));
7683
@@ -174,7 +181,7 @@ bool RosbagDataProvider::parseRosbag(const std::string& bag_path,
174181 topics.push_back (right_imgs_topic_);
175182 topics.push_back (imu_topic_);
176183 if (!gt_odom_topic_.empty ()) {
177- CHECK ( vio_params_.backend_params_ ->autoInitialize_ == 0 )
184+ LOG_IF (WARNING, vio_params_.backend_params_ ->autoInitialize_ == 0 )
178185 << " Provided a gt_odom_topic; but autoInitialize "
179186 " (BackendParameters.yaml) is not set to 0,"
180187 " meaning no ground-truth initialization will be done... "
@@ -191,6 +198,7 @@ bool RosbagDataProvider::parseRosbag(const std::string& bag_path,
191198 // Query rosbag for given topics
192199 rosbag::View view (bag, rosbag::TopicQuery (topics));
193200
201+ int imu_msg_count = 0 ;
194202 // Keep track of this since we expect IMU data before an image.
195203 bool start_parsing_stereo = false ;
196204 // For some datasets, we have duplicated measurements for the same time.
@@ -213,6 +221,7 @@ bool RosbagDataProvider::parseRosbag(const std::string& bag_path,
213221 // Send IMU data directly to VIO at parse level for speed boost:
214222 CHECK (imu_single_callback_)
215223 << " Did you forget to register the IMU callback?" ;
224+ VLOG (10 ) << " IMU msg count: " << imu_msg_count++;
216225 imu_single_callback_ (ImuMeasurement (imu_data_timestamp, imu_accgyr));
217226
218227 rosbag_data->imu_msgs_ .push_back (imu_msg);
@@ -269,22 +278,22 @@ bool RosbagDataProvider::parseRosbag(const std::string& bag_path,
269278 bag.close ();
270279
271280 // Sanity check:
272- ROS_ERROR_COND (rosbag_data-> left_imgs_ . size () == 0 ||
273- rosbag_data->right_imgs_ .size () == 0 ,
274- " No images parsed from rosbag. " );
275- ROS_ERROR_COND (
276- rosbag_data-> left_imgs_ . size () != rosbag_data-> right_imgs_ . size () ,
277- " Unequal number of images from left and right cmaeras. " );
278- ROS_ERROR_COND (
279- rosbag_data->imu_msgs_ .size () <= rosbag_data->left_imgs_ .size (),
280- " Less than or equal number of imu data as image data." ) ;
281- ROS_ERROR_COND (
282- !gt_odom_topic_.empty () && rosbag_data->gt_odometry_ .size () == 0 ,
283- " Requested to parse ground-truth odometry, but parsed 0 msgs." ) ;
284- ROS_ERROR_COND (
285- !gt_odom_topic_.empty () &&
286- rosbag_data->gt_odometry_ .size () < rosbag_data->left_imgs_ .size (),
287- " Fewer ground_truth data than image data." ) ;
281+ LOG_IF (FATAL,
282+ rosbag_data->left_imgs_ .size () == 0 ||
283+ rosbag_data-> right_imgs_ . size () == 0 )
284+ << " No images parsed from rosbag. " ;
285+ LOG_IF (FATAL ,
286+ rosbag_data-> left_imgs_ . size () != rosbag_data-> right_imgs_ . size ())
287+ << " Unequal number of images from left and right cameras. " ;
288+ LOG_IF (FATAL, rosbag_data->imu_msgs_ .size () <= rosbag_data->left_imgs_ .size ())
289+ << " Less than or equal number of imu data as image data." ;
290+ LOG_IF (FATAL,
291+ !gt_odom_topic_.empty () && rosbag_data->gt_odometry_ .size () == 0 )
292+ << " Requested to parse ground-truth odometry, but parsed 0 msgs." ;
293+ LOG_IF (WARNING,
294+ !gt_odom_topic_.empty () &&
295+ rosbag_data->gt_odometry_ .size () < rosbag_data->left_imgs_ .size ())
296+ << " Fewer ground_truth data than image data." ;
288297 LOG (INFO) << " Finished parsing rosbag data." ;
289298 return true ;
290299}
0 commit comments