Pointcloud2 messages and logical operations...
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!
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
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: seepcl::concatenatePointCloud(..)
.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.
I'm trying to implement the question I asked here: http://answers.ros.org/question/26387...
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.
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.
I was able to impliment it quickly by looping through every element in the
data
portion of the PC2 message and runningcombinedPC_.data[point] = pc2_.data[point] & pc1_.data[point];
Since data is an array of uint8s, it worked out well.