question about "C++ usage example for RGB-D Mapping"

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

question about "C++ usage example for RGB-D Mapping"

TouchDeeper
Hi,
I test the C++ usage example for RGB-D Mapping https://github.com/introlab/rtabmap/wiki/Cplusplus-RGBD-Mapping
But error occur:
fatal error: rtabmap/core/odometryf2m.h: No such file or directory
I find the odometryf2m.h in the rtabmap/core/odometry/OdometryF2M.h and replace the original path, this error didn't occur.
But another error occurs:
error: ‘const class rtabmap::Statistics’ has no member named ‘getSignatures’
                 else if(uContains(stats.getSignatures(), iter->first))
I guess it might because the example did't update for a long time.
Can you help me to fix the error? Thanks a lot.
Reply | Threaded
Open this post in threaded view
|

Re: question about "C++ usage example for RGB-D Mapping"

TouchDeeper
Is there any fix?
Reply | Threaded
Open this post in threaded view
|

Re: question about "C++ usage example for RGB-D Mapping"

matlabbe
Administrator
Yeah, the code in the wiki was outdated, it is updated now. thx for reporting. Note that you can also copy the files linked at top directly too (which are always tested).

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: question about "C++ usage example for RGB-D Mapping"

TouchDeeper
Hi, matlabbe
Thanks for your reply.
I have tested the update. It works well.
Reply | Threaded
Open this post in threaded view
|

Re: question about "C++ usage example for RGB-D Mapping"

TouchDeeper
Hi, matlabbe
First time I run the example, the code runs well and the  point cloud will be saved in the build directory,
However, after the first time, a warning occurs, and the point cloud can't be saved in the build directory
[ WARN] (2019-03-16 12:05:48.102) Rtabmap.cpp:302::init() Using empty database. Mapping session will not be saved unless it is closed with an output database path.
Saving rtabmap_cloud.pcd...

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
Can you give me some advice, thanks a lot!
Reply | Threaded
Open this post in threaded view
|

Re: question about "C++ usage example for RGB-D Mapping"

matlabbe
Administrator
Hi,

That warning is fine, it is because for the example we don't create a database so that all is working in RAM.

Here is a normal output (using openni2 driver):
./rtabmap-rgbd_mapping 1
Warning: USB events thread - failed to set priority. This might cause loss of data...
[ WARN] (2019-03-22 18:51:21.187) CameraModel.cpp:358::load() Could not load calibration file "./PS1080_depth.yaml".
[ WARN] (2019-03-22 18:51:21.188) CameraModel.cpp:358::load() Could not load calibration file "./PS1080_rgb.yaml".
[ WARN] (2019-03-22 18:51:21.188) CameraOpenNI2.cpp:253::init() Missing calibration files for camera "PS1080" in "." folder, default calibration used.
[ WARN] (2019-03-22 18:51:25.077) Rtabmap.cpp:302::init() Using empty database. Mapping session will not be saved unless it is closed with an output database path.
Saving rtabmap_cloud.pcd...
Voxel grid filtering of the assembled cloud (voxel=0.010000, 79802 points)
Saving rtabmap_cloud.pcd... done! (72583 points)
Saving rtabmap_trajectory.txt ...
Saving rtabmap_trajectory.txt... done!

However, there should not be an error "Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)". You can try launching in gdb:
$ gdb --args ./rtabmap-rgbd_mapping 1
Type "run" to start, when it crashes, do "bt" to show log.

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: question about "C++ usage example for RGB-D Mapping"

TouchDeeper
Hi, matlabbe
After the first run, I run the example using
gdb --args ./rgbd_mapping 8
  And the output is below:
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./rgbd_mapping...(no debugging symbols found)...done.
(gdb) run
Starting program: /home/wang/CLionProjects/rtabmap/example/cmake-build-debug/rgbd_mapping 8
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffb2872700 (LWP 5725)]
[New Thread 0x7fffb2071700 (LWP 5726)]
[New Thread 0x7fffb1870700 (LWP 5727)]
[New Thread 0x7fffb106f700 (LWP 5728)]
[New Thread 0x7fffb086e700 (LWP 5729)]
[New Thread 0x7fffb006d700 (LWP 5730)]
[New Thread 0x7fffaf86c700 (LWP 5731)]
[Thread 0x7fffaf86c700 (LWP 5731) exited]
[New Thread 0x7fffaf86c700 (LWP 5732)]
[New Thread 0x7fffaf06b700 (LWP 5733)]
[New Thread 0x7fffae86a700 (LWP 5734)]
[New Thread 0x7fffae069700 (LWP 5735)]
[New Thread 0x7fffad868700 (LWP 5736)]
[New Thread 0x7fffad067700 (LWP 5737)]
terminate called after throwing an instance of 'rs2::invalid_value_error'
  what():  set_xu(id=2) failed! Last Error: Input/output error

Thread 1 "rgbd_mapping" received signal SIGABRT, Aborted.
0x00007ffff1413428 in __GI_raise (sig=sig@entry=6)
    at ../sysdeps/unix/sysv/linux/raise.c:54
54	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff1413428 in __GI_raise (sig=sig@entry=6)
    at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007ffff141502a in __GI_abort () at abort.c:89
#2  0x00007ffff1a4d84d in __gnu_cxx::__verbose_terminate_handler() ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff1a4b6b6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff1a4b701 in std::terminate() ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff1a4b919 in __cxa_throw ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff76fa878 in rs2::error::handle(rs2_error*) ()
   from /home/wang/rtabmap_ws/devel/lib/librtabmap_core.so.0.19
#7  0x00007ffff76f5181 in rtabmap::CameraRealSense2::init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
   from /home/wang/rtabmap_ws/devel/lib/librtabmap_core.so.0.19
#8  0x000000000045a89c in main ()
(gdb) 
Reply | Threaded
Open this post in threaded view
|

Re: question about "C++ usage example for RGB-D Mapping"

matlabbe
Administrator
Hi,

It seems crashing when calling realsense API functions on initialization, a rs2::invalid_value_error exception is thrown but not caught in this function. Is the tool coming with realsense2 sdk able to open the camera? Here it looks like a bad configuration is sent to realsense and it doesn't like it.

What is your camera model? and what is the realsense sdk version?

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: question about "C++ usage example for RGB-D Mapping"

TouchDeeper
Hi, matlabbe
The tool coming with realsense2 SDK work well.
The camera is d435, SDK version is 2.18.1.
Reply | Threaded
Open this post in threaded view
|

Re: question about "C++ usage example for RGB-D Mapping"

TouchDeeper
In reply to this post by matlabbe
Hello Mathieu,

What confuses me most is the example runs well in the first run every time I restart the computer.
would it be a problem of RAM?

Best wishes,
Tinda
Reply | Threaded
Open this post in threaded view
|

Re: question about "C++ usage example for RGB-D Mapping"

matlabbe
Administrator
Hi,

If you unplug/plug the camera from usb instead of rebooting, does it work? If so,  I've seen this issue some time ago, cannot find back the post though. It is something like that the API doesn't release completly the camera after usage, causing a problem when trying to start again.

Cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: question about "C++ usage example for RGB-D Mapping"

TouchDeeper
Hello Mathieu,

Thanks for your reply.

But the
roslaunch rtabmap_ros rtabmap.launch
 works well,
Can the program modify to solve the problem?

I will find out a way to close the realsense after I exit the program.

Regards
Tingda
Reply | Threaded
Open this post in threaded view
|

Re: question about "C++ usage example for RGB-D Mapping"

matlabbe
Administrator
Hi,

If you kill realsense ros node and restart it and the camera works, we could try to identify the steps they use to initialize the camera and close the camera, then compare them to what is done in rtabmap's library (See CameraRealsense2). Maybe the API has been updated since I integrated it in rtabmap (here I just delete the realsense objects, a close/release function maybe required before deleting them).

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: question about "C++ usage example for RGB-D Mapping"

TouchDeeper
Hello Mathieu

Thanks for your advice, I check the ROS package of realsense. There has a release operation indeed as you said. And I add the release operation in the cameraRealsense2.cpp. It works, the problem has gone.

I have opened a new pull request. You can check it.

Regards,
Tingda
Reply | Threaded
Open this post in threaded view
|

Re: question about "C++ usage example for RGB-D Mapping"

matlabbe
Administrator
It has been merged, thx!