strands-project / mongodb_store

MongoDB tools for storing and analysing runs of ROS systems.
BSD 3-Clause "New" or "Revised" License
49 stars 72 forks source link

Can't log compressed color images from kinect #228

Open neverude opened 6 years ago

neverude commented 6 years ago

Hello everyone,

I tried to record images from the kinect using mongodb_log (from source). Most of the topics work just fine, but when I try to log the compressed color image topic using rosrun mongodb_log mongodb_log.py /camera/rgb/image_raw/compressed the topics won't be logged into the database and it returns:

Adding topic /camera/rgb/image_raw/compressed
DETECTED compressed image topic /camera/rgb/image_raw/compressed, using fast C++ logger
mongodb_log_cimg: /usr/include/boost/smart_ptr/scoped_ptr.hpp:99: T* boost::scoped_ptr<T>::operator->() const [with T = mongo::AtomicWord<unsigned int>]: Assertion `px != 0' failed.

And no entries are created in the mongodb. Same for topic /camera/depth_registered/image_raw/compressed

I use ROS Kinetic and Ubuntu 16.04

PS.: when I run the kinect with the freenect-launch package (roslaunch freenect_launch freenect-registered-xyzrgb.launch) I get those warnings on startup:

[ INFO] [1530279220.317296436]: rgb_frame_id = 'camera_rgb_optical_frame'
[ INFO] [1530279220.317347058]: depth_frame_id = 'camera_depth_optical_frame'
[ WARN] [1530279220.325129058]: Camera calibration file /home/tammo/.ros/camera_info/rgb_B00365704739132B.yaml not found.
[ WARN] [1530279220.325179201]: Using default parameters for RGB camera calibration.
[ WARN] [1530279220.325210333]: Camera calibration file /home/tammo/.ros/camera_info/depth_B00365704739132B.yaml not found.
[ WARN] [1530279220.325239629]: Using default parameters for IR camera calibration.
[ INFO] [1530279222.588314297]: Stopping device RGB and Depth stream flush.
hawesie commented 6 years ago

You should be able to run mongodb_log_cimg from the command line for just this topic. If you do that, do you see any other errors? Could you run it in a debugger to see where the error is happening in the code?

neverude commented 6 years ago

Thanks for the reply! When I run mongodb_log_cimg from command line I get the same error. My debugger gives me this

Thread 1 "mongodb_log_cim" hit Breakpoint 1, msg_callback (msg=...) at /home/tammo/catkin_ws/src/mongodb_store/mongodb_log/src/mongodb_log_cimg.cpp:56 56 mongodb_conn->insert(collection, document.obj());

Switching to thread 7 (Thread 0x7f2e8960d700 (LWP 5492)) ... (repeats 17x)

Thread 1 "mongodb_log_cim" received signal SIGABRT, Aborted. 0x00007f2e90af3428 in raise () from /lib/x86_64-linux-gnu/libc.so.6

But I have reason to think that the problem lies somewhere in the bsonobjbuilder.h or bsonobj.h in the libmongocxx package.

It may be of importance to mention that I use mongodb Version 2.6.10 as of now.

hawesie commented 6 years ago

My first guess is that the cast on this line is failing, since the error says the data in the boost::scoped_ptr is null. Is there any data in the message? Any ideas what else could cause that failure?

neverude commented 6 years ago

I get a warning while compiling, that the auto_ptr pointer is deprecated. I changed them to unique_ptr without any effect. But I think you might be right with the problem lying in this line. The pointer has some negative values, which are not cast to unsigned values correctly. It has some negative values, which probably lead to the error I get.

hawesie commented 6 years ago

So there's a problem with the input then?

bbferka commented 6 years ago

hi all; after quickly looking at this and testing it with a RealSense and a the Kinect on the PR2 I was experiencing the same problem;

The issue is that with legacy cxx drivers you need to call mongo::client::initialize(); before you can start logging;

Also the collection name is not set and no error message is shown except the exception that mongo throws. I did not test but I am pretty sure that the other loggers (tf and pcl) would have the same behaviour;

I fixed this with #229; Tested on Ubuntu 16.04 and mongodb 3.4

@countdueki please test it this works for you

neverude commented 6 years ago

@bbferka that did the trick! I only had to add the database and collection, seperated by a dot. So e.g. in my case I added -c db.kinect_collection so the full command was rosrun mongodb_log mongodb_log_cimg -t /camera/rgb/image_color/compressed -n camera -c db.kinect_log It started logging and the collections seemed to be complete. Appreciate the fast responses!

For completeness: Only using -c kinect_collection gave the error terminate called after throwing an instance of 'mongo::MsgAssertionException' what(): nsToCollectionSubstring: no .

bbferka commented 6 years ago

@countdueki glad to hear that; @hawesie I will try to figure out a way so this fix can also compile on Indigo, since currently the build fails (see #229 for details )

chris2401 commented 5 years ago

@bbferka could you please explain in more detail how you got it working? i am running ros kinetic on ubuntu 16.04. with mongodb-store version 0.4.4 and i want to capture compressed color images of a realsense d435.

running: rosrun mongodb_log mongodb_log.py -e /camera/color/image_raw/compressed results in Adding topic /camera/color/image_raw/compressed DETECTED compressed image topic /camera/color/image_raw/compressed, using fast C++ logger mongodb_log_cimg: /usr/include/boost/smart_ptr/scoped_ptr.hpp:99: T* boost::scoped_ptr<T>::operator->() const [with T = mongo::AtomicWord<unsigned int>]: Assertionpx != 0' failed. `

running rosrun mongodb_log mongodb_log_cimg -t /camera/color/image_raw/compressed -n camera -c db.realsense_log results in mongodb_log_cimg: /usr/include/boost/smart_ptr/scoped_ptr.hpp:99: T* boost::scoped_ptr<T>::operator->() const [with T = mongo::AtomicWord<unsigned int>]: Assertionpx != 0' failed. Aborted (core dumped)`

I am unsure how to debug further from here.