From 2c635f72421945c70ab6fda09c79eca3cc5da0c1 Mon Sep 17 00:00:00 2001 From: matlabbe Date: Fri, 22 Jan 2021 14:18:30 -0500 Subject: [PATCH] rtabmapviz: if odom topic doesn't have child_frame_id set, log a warning. --- src/GuiWrapper.cpp | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/GuiWrapper.cpp b/src/GuiWrapper.cpp index ef617eac..c1c1f633 100644 --- a/src/GuiWrapper.cpp +++ b/src/GuiWrapper.cpp @@ -440,7 +440,14 @@ void GuiWrapper::commonDepthCallback( if(odomMsg.get()) { odomHeader = odomMsg->header; - frameId = odomMsg->child_frame_id; + if(!odomMsg->child_frame_id.empty()) + { + frameId = odomMsg->child_frame_id; + } + else + { + ROS_WARN("Received odom topic with child_frame_id not set! Using \"%s\" as base frame.", frameId_.c_str()); + } } else { @@ -618,7 +625,14 @@ void GuiWrapper::commonStereoCallback( if(odomMsg.get()) { odomHeader = odomMsg->header; - frameId = odomMsg->child_frame_id; + if(!odomMsg->child_frame_id.empty()) + { + frameId = odomMsg->child_frame_id; + } + else + { + ROS_WARN("Received odom topic with child_frame_id not set! Using \"%s\" as base frame.", frameId_.c_str()); + } } else { @@ -780,7 +794,14 @@ void GuiWrapper::commonLaserScanCallback( if(odomMsg.get()) { odomHeader = odomMsg->header; - frameId = odomMsg->child_frame_id; + if(!odomMsg->child_frame_id.empty()) + { + frameId = odomMsg->child_frame_id; + } + else + { + ROS_WARN("Received odom topic with child_frame_id not set! Using \"%s\" as base frame.", frameId_.c_str()); + } } else {