Re: rtabmap node crashes when I try to approx_sync icp_odometry and rgb camera

Posted by GilMe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/rtabmap-node-crashes-when-I-try-to-approx-sync-icp-odometry-and-rgb-camera-tp9181p9195.html

First of all thanks your quick reply.

I ran gdb as for your suggestion. Apparently the issue doesn't have anything to do with sync. The crash happens in the convertRGBDMsgs function in the MsgConversion.cpp
The program crashes in this part of the code (lines 1859-1864):

if(isDepth)
        {
                UASSERT_MSG(
                                imageWidth/depthWidth == imageHeight/depthHeight,
                                uFormat("rgb=%dx%d depth=%dx%d", imageWidth, imageHeight, depthWidth, depthHeight).c_str());
        }

Since the message doesn't have a depth image than depthWidth = 0 and I get an arithmetic exception.

I tried to investigate why isDepth is true and got to lines 1835-1838 where is defined:

bool isDepth = depthMsgs.empty() || (depthMsgs[0].get() != 0 && (
                        depthMsgs[0]->encoding.compare(sensor_msgs::image_encodings::TYPE_16UC1) == 0 ||
                        depthMsgs[0]->encoding.compare(sensor_msgs::image_encodings::TYPE_32FC1) == 0 ||
                        depthMsgs[0]->encoding.compare(sensor_msgs::image_encodings::MONO16) == 0));

I thought that there might be a bug and should be:

bool isDepth = !depthMsgs.empty() && (depthMsgs[0].get() != 0 && (
                        depthMsgs[0]->encoding.compare(sensor_msgs::image_encodings::TYPE_16UC1) == 0 ||
                        depthMsgs[0]->encoding.compare(sensor_msgs::image_encodings::TYPE_32FC1) == 0 ||
                        depthMsgs[0]->encoding.compare(sensor_msgs::image_encodings::MONO16) == 0));

but when I fixed and ran the changed code, I got the following warning " We cannot estimated the baseline of the rectified images with tf! (/camera_link->/camera_link = xyz=0.000000,0.000000,0.000000 rpy=0.000000,-0.000000,0.000000)", and it doesn't really work.

I then saw that if "isDepth" is false than it tries to calculate stereo.

I wanted to ask. I am trying to run rtabmap with lidar and a normal camera. I used the "subscribe_rgb". Why is it trying to get depth images? Why is it sent to convertRGBDMsgs function?