turtlebot / turtlebot_apps

A group of simple demos and exmaples to run on your TurtleBot to help you get started with ROS and TurtleBot.
http://www.ros.org/wiki/turtlebot_apps
196 stars 225 forks source link

pano_cv/opencv.cpp panorama integration silent fail [indigo] #98

Closed kentsommer closed 10 years ago

kentsommer commented 10 years ago

In the functon convert_from_cvmat, both the call PyString_Check(m->data) and PyObject_AsWriteBuffer(m->data, &buffer, &buffer_len) will cause the pano_server to die silently. m->data looks like it is returning an int in hex while m is simply a pointer to a location in memory (The last debug print I ran returned: "m->data print: 0x3" and "m print: 0x245a250")

PyObject_AsWriteBuffer is deprecated in python2, however, it doesn't seem to be the reason for the issue above.

datatype passed into convert_from_cvmat is numpy.ndarray. My best guess as to why the above behavior is being exhibited is that both PyString_Check and PyObject_AsWriteBuffer cannot handle the input type and just quit silently.

Steps to reproduce on indigo

On turtlebot run:

Will run until it hits one of the two above function calls and then the process will die printing: [pano_server-6] process has died [pid 5853, exit code -11]

jihoonl commented 10 years ago

Can you link the file which causes the problem?

jihoonl commented 10 years ago

https://github.com/turtlebot/turtlebot_apps/blob/indigo/software/pano/pano_py/src/pano_cv/opencv.cpp#L52

jihoonl commented 10 years ago

@stonier cmake_modules dependency would help this issue? Since it is using numpy?

kentsommer commented 10 years ago

Progress!

In capture_server.py I added a conversion from numpy.ndarray to cv2.cv.cvarray. That image can be passed to pcv.convertCvMat2Mat which does the final conversion to cv::Mat before finally passing the fully converted image to the stitch engine.

The turtlebot will now rotate while taking pictures and publishing them (verified).

Current issues

kentsommer commented 10 years ago

Fixed/Updated

See pull request #99 for more information. Closing this out since fix has been merged in #99