On 01/21/2011 06:17 PM, Radu Bogdan Rusu wrote:
> Christian,
>
>
> On 01/21/2011 05:32 AM, cmuell2s wrote:
>> Hello all,
>>
>> I stuck at a small problem. I would like to publish a vector/array of
>> pcl::PointCloud<pcl::PointXYZ>.
>> I couldn't find a sensor_msg or std_msg which would do it, did I
>> overlooked sth?
> Unfortunately you need to define your own message type for that. So far we only support publishing a single
> pcl::PointCloud<T> type.
>
> In general, if you have a message Foo.msg and you want to send an array of Foo, you need to declare another message
> Bar.msg, which has "Foo[] foo" inside.
>
> Cheers,
> Radu.
> --
> http://pointclouds.org
> _______________________________________________
> ros-users mailing list
> ros-users@code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
Hi all,
thanks a lot for your help! I generated a new message.
Content of the new created msg/pointcloudVector.msg file :
sensor_msgs/PointCloud2[] pointClouds
CMakeList.txt
uncomment -> rosbuild_genmsg()
Publisher:
ros::Publisher pub = node.advertise<package_name::pointCloudVector>
("topic_name", 1);
Subscriber:
ros::Subscriber sub = node.subscribe("topic_name", 1, callback);
Callback:
void callback(const package_name::pointCloudVectorPtr& pointCloudVectorMsg)
{
...
std::vector<sensor_msgs::PointCloud2> pclVector;
pclVector = pointCloudVectorMsg->pointClouds; // access to the
array of sensor_msgs/PointCloud2
...
}
However -- as you mentioned already -- in the new release, the vector of
msgs could be replaced by vector of pointCloud2.
Cheers,
Christian