Push_back doesn't work
hi everyone, i'm writing a node that could save 3 coordinate and then add a point to a pointcloud. i'm trying to use pushback for the array of points in the cloud, this is the code:
struct stru
{
float x,y,z;
};
sensor_msgs::PointCloud output;
mypoints.x = input->pose.position.x;
mypoints.y = input->pose.position.y;
mypoints.z = input->pose.position.z;
output.points.push_back(mypoints);
and the catkin_make give me this error:
/home/jacopo/catkin_ws/src/beginner_tutorials/src/svocloud.cpp: In member function ‘void SubAndPub::callback(const ConstPtr&)’:
/home/jacopo/catkin_ws/src/beginner_tutorials/src/svocloud.cpp:56:39: error: no matching function for call to ‘std::vector<geometry_msgs::Point32_<std::allocator<void> >, std::allocator<geometry_msgs::Point32_<std::allocator<void> > > >::push_back(stru&)’
/home/jacopo/catkin_ws/src/beginner_tutorials/src/svocloud.cpp:56:39: note: candidate is:
/usr/include/c++/4.6/bits/stl_vector.h:826:7: note: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = geometry_msgs::Point32_<std::allocator<void> >, _Alloc = std::allocator<geometry_msgs::Point32_<std::allocator<void> > >, std::vector<_Tp, _Alloc>::value_type = geometry_msgs::Point32_<std::allocator<void> >]
/usr/include/c++/4.6/bits/stl_vector.h:826:7: note: no known conversion for argument 1 from ‘stru’ to ‘const value_type& {aka const geometry_msgs::Point32_<std::allocator<void> >&}’
i'm missing something about push_back but cannot understand what.... do somebody could help me??
thanks!