Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't log compressed color images from kinect #228

Open
neverude opened this issue Jun 29, 2018 · 9 comments
Open

Can't log compressed color images from kinect #228

neverude opened this issue Jun 29, 2018 · 9 comments

Comments

@neverude
Copy link

neverude commented Jun 29, 2018

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
Copy link
Member

hawesie commented Jul 4, 2018

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
Copy link
Author

neverude commented Jul 4, 2018

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
Copy link
Member

hawesie commented Jul 5, 2018

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
Copy link
Author

neverude commented Jul 8, 2018

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
Copy link
Member

hawesie commented Jul 9, 2018

So there's a problem with the input then?

@bbferka
Copy link
Contributor

bbferka commented Jul 10, 2018

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
Copy link
Author

@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
Copy link
Contributor

bbferka commented Jul 16, 2018

@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
Copy link

@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>]: Assertion px != 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>]: Assertion px != 0' failed.
Aborted (core dumped)`

I am unsure how to debug further from here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants