Pointcloud2 messages and logical operations...

asked 2017-06-21 18:24:17 -0600

Hello!

I currently am writing something that I need to AND two pointclouds together, my question is, how do I go about doing such.

I already tried something similar to:

combined_pc.data = pointcloud_a.data && pointcloud_b.data to no avail.

Do I need to iterate through every element in "data" and AND them together, then shove it into combined_pc.data?

When I try this, it fails to build with this error snippet:

error: no match for ‘operator&&’ (operand types are ‘sensor_msgs::PointCloud2_<std::allocator<void> >::_data_type {aka std::vector<unsigned char>}’ and ‘sensor_msgs::PointCloud2_<std::allocator<void> >::_data_type {aka std::vector<unsigned char>}’) combinedPC_.data = baseframeL_.data && baseframeR_.data; ^

Thanks in advance!

edit retag flag offensive close merge delete

Comments

What means AND in this content for you?

So when you have for example two points (here 2d for simplification) (1,2) and (4,3), what should be the result of

(1,2) && (4,3) = ??
chwimmer gravatar image chwimmer  ( 2017-06-22 03:17:55 -0600 )edit

Do you really need to AND them (as in: the logical operation), or do you want to concatenate / merge two point clouds? For the latter: pcl_conversions would seem to offer some tooling: see pcl::concatenatePointCloud(..).

gvdhoorn gravatar image gvdhoorn  ( 2017-06-22 04:33:25 -0600 )edit

I'm trying to do is simulate a sensor with a structured light sensor that has a rather long baseline (about 1m) between the projector and the receiving camera. I'm trying to simulate the shadow that would be case if we had a robot block the camera or projector. I'm using two depth cameras to ad hoc.

atomoclast gravatar image atomoclast  ( 2017-06-22 09:42:13 -0600 )edit

I'm trying to implement the question I asked here: http://answers.ros.org/question/26387...

atomoclast gravatar image atomoclast  ( 2017-06-22 10:13:00 -0600 )edit

I don't think those kind of boolean operations are supported by PCL directly, but a quick google shows: fferri/pcl-boolean-op. Note that I've not used/tested this myself, it's just the first result on Google.

gvdhoorn gravatar image gvdhoorn  ( 2017-06-22 11:02:52 -0600 )edit

Also: this is more a PCL question, not so much ROS. You might want to try this question over at www.pcl-users.org.

I can imagine that the floating point nature of the data makes these kind of thing less straightforward than you would initially assume.

gvdhoorn gravatar image gvdhoorn  ( 2017-06-22 11:03:51 -0600 )edit

I was able to impliment it quickly by looping through every element in the data portion of the PC2 message and running combinedPC_.data[point] = pc2_.data[point] & pc1_.data[point];

Since data is an array of uint8s, it worked out well.

atomoclast gravatar image atomoclast  ( 2017-06-22 14:58:05 -0600 )edit