Hello,
I am working on a node that colors point clouds with a camera image. My strategy is to project each point on the camera image plane, and find the corresponding pixel color.
In order to do so, I use the image_geometry::PinholeCameraModel object that can initialize itself directly from a sensor_msgs::camera_info message via the function fromCameraInfo and project points via the function project3dToPixel.
The current setup I have consist of a labybug3 camera and a tilting hokuyo LRF. I haven't develop a proper driver for the camera, so for the moment, I am using the camera_1394 package using the following configuration:
<node pkg="camera1394" type="camera1394_node" name="ladybug" >
<param name="guid" value="00b09d01009f01a2" />
<param name="video_mode" value="1600x1200_mono8" />
<param name="frame_id" value="ladybug0" />
<param name="bayer_pattern" value="rggb" />
<param name="auto_white_balance" value="2" />
</node>
As you can notice, I do not provide any calibration info, which result in uncalibrated camera_info messages. (from camera1394: If CameraInfo calibration is not available or is incompatible with the current video_mode, uncalibrated data will be provided instead.)
Which is indeed what I can observe with rostopic:
header:
seq: 22480
stamp:
secs: 1305821789
nsecs: 356266975
frame_id: /ladybug0
height: 1200
width: 1600
distortion_model: ''
D: []
K: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
R: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
P: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
binning_x: 0
binning_y: 0
roi:
x_offset: 0
y_offset: 0
height: 0
width: 0
do_rectify: False
---
My problem is that I am able to initialize my camera model using those camera_info messages, but my program keeps crashing on the call to project3dToPixel.
Code:
cv::Point2d pixel;
pcl::PointCloud<pcl::PointXYZ> cloud_xyz;
[...]
for(int i = 0 ; i < (int) cloud_xyz.size(); i++)
{
if (isnan (cloud_xyz.points[i].x) || isnan (cloud_xyz.points[i].y) || isnan (cloud_xyz.points[i].z))
continue;
ROS_INFO("point with coordinates %f, %f, %f", cloud_xyz.points[i].x, cloud_xyz.points[i].y, cloud_xyz.points[i].z);
ROS_INFO("A");
cv::Point3d point(cloud_xyz.points[i].x, cloud_xyz.points[i].y, cloud_xyz.points[i].z);
ROS_INFO("B");
pixel = cam_model.project3dToPixel(point);
Trace:
[ INFO] [1305820636.985045709]: point with coordinates 0.245843, -6.119996, 0.848742
[ INFO] [1305820636.985082376]: A
[ INFO] [1305820636.985117506]: B
Segmentation fault
I had a look inside image_geometry::PinholeCameraModel's documentation but I can't find any information on the case where the camera_info messages are 0.
My best guess so far is that the on calibrated camera_info message triggers the segfault at runtime. Does anyone has experience with this issue?
Thanks for your help
Raph
Originally posted by raphael favier on ROS Answers with karma: 1382 on 2011-05-19
Post score: 1
Original comments
Comment by Asomerville on 2011-05-20:
You will have to reproduce the segfault to get the core. If you've done that, and it still doesn't show up, then I'm not sure. It should be there.
Comment by raphael favier on 2011-05-19:
I followed your method but I haven't any "core" folder or file in my ~/.ros folder. Any idea?
Comment by Asomerville on 2011-05-19:
actually see this post here if you just want the stack trace without having to modify anything: http://answers.ros.org/question/910/is-there-functionality-built-into-ros-to-get-nodes
Comment by Eric Perko on 2011-05-19:
Use GDB ( http://www.ros.org/wiki/roslaunch/Tutorials/Roslaunch%20Nodes%20in%20Valgrind%20or%20GDB ) , when it starts type "run" if necessary and when it crashes, type "bt". If you do get a stacktrace, it would be good to attach to any ticket you create.
Comment by raphael favier on 2011-05-19:
Noob question: any tool you advise for this?
Comment by Asomerville on 2011-05-19:
I don't know off hand, but might be able to tell you with a stacktrace.
Comment by brice rebsamen on 2013-07-09:
Hi. Have you made any progress with the ladybug? I'm trying to setup mine and I'd gladly learn from your experience.