Hi all,
I have created a custom message for a vector of PointCloud2 with name clusterVector.msg, and inside that vector I have the following line:
sensor_msgs/PointCloud2[] clusterClouds
This message is inside one of my custom made packages Object_detection_module. Now I am trying to use this so I am doing the following:
1) I am declaring the header:
object_detection_module/clusterVector.h
2) I am instantiating an object of that type:
object_detection_module::clusterVectorConstPtr msg1;
3) I am trying to push_back a type 2 point cloud as follows:
sensor_msgs::PointCloud2::Ptr test_message (new sensor_msgs::PointCloud2 ());
msg1->clusterClouds.push_back(test_message);
Unfortunately, when I am trying to compile my code I get the following error:
error: no matching function for call to ‘std::vector>, std::allocator>>>::push_back(sensor_msgs::PointCloud2_>::Ptr&) const’
/home/polychronis/catkin_workspace/src/object_detection_module/src/object_detection_class.cpp:100:46: note: candidates are:
/usr/include/c++/4.6/bits/stl_vector.h:826:7: note: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = sensor_msgs::PointCloud2_>, _Alloc = std::allocator>>, std::vector<_Tp, _Alloc>::value_type = sensor_msgs::PointCloud2_>]
/usr/include/c++/4.6/bits/stl_vector.h:826:7: note: no known conversion for argument 1 from ‘sensor_msgs::PointCloud2_>::Ptr {aka boost::shared_ptr>>}’ to ‘const value_type& {aka const sensor_msgs::PointCloud2_>&}’
/usr/include/c++/4.6/bits/stl_vector.h:839:7: note: void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = sensor_msgs::PointCloud2_>, _Alloc = std::allocator>>, std::vector<_Tp, _Alloc>::value_type = sensor_msgs::PointCloud2_>]
/usr/include/c++/4.6/bits/stl_vector.h:839:7: note: no known conversion for argument 1 from ‘sensor_msgs::PointCloud2_>::Ptr {aka boost::shared_ptr>>}’ to ‘std::vector>, std::allocator>>>::value_type&& {aka sensor_msgs::PointCloud2_>&&}’
make[2]: *** [object_detection_module/CMakeFiles/object_detection_main.dir/src/object_detection_class.cpp.o] Error 1
make[1]: *** [object_detection_module/CMakeFiles/object_detection_main.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed
Any ideas what I am doing wrong? Any help would be greatly appreciated.
Best,
Akis
↧