ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
coord_proces::xyz obj_coords;
[..]
obj_coords.points[i] = pt;

obj_coords.points is a std::vector. You cannot just index into a std::vector without first reserving space for the objects. You must either first reserve(..) or you should use push_back(..).

coord_proces::xyz obj_coords;
[..]
obj_coords.points[i] = pt;

obj_coords.points is a std::vector. You cannot just index into a std::vector without first reserving space for the objects. You must either first reserve(..) or you should use push_back(..).

coord_proces::xyz obj_coords;
[..]
obj_coords.points[i] = pt;

obj_coords.points is a std::vector. (see wiki/msg: Message Description Specification). You cannot just index into a std::vector without first reserving space for the objects. You must either first reserve(..) or you should use push_back(..).

coord_proces::xyz obj_coords;
[..]
obj_coords.points[i] = pt;

obj_coords.points is a std::vector (see wiki/msg: Message Description Specification). You cannot just index into a std::vector without first reserving space for the objects. You must either first reserve(..) or you should use push_back(..).

The next node uses these coordinates to filter a distance from a pointcloud msg.

From the code it looks like you're essentially implementing a passthrough filter with a threshold for Z set to min 5cm and max 2m. You might want to take a look at pcl/documentation/Filtering a PointCloud using a PassThrough filter which essentially does the same thing, but in much less lines (and potentially more efficient).

coord_proces::xyz obj_coords;
[..]
obj_coords.points[i] = pt;

obj_coords.points is a std::vector (see wiki/msg: Message Description Specification). You cannot just index into a std::vector without first reserving space for the objects. You must either first reserve(..) or you should use push_back(..).

The next node uses these coordinates to filter a distance from a pointcloud msg.

From the code it looks like you're essentially implementing a passthrough filter with a threshold for Z set to min 5cm and max 2m. You might want to take a look at pcl/documentation/Filtering a PointCloud using a PassThrough filter which essentially does the same thing, but in much less lines (and potentially more efficient).


Edit:

The program crashes between check2 and 3.

that would be one symptom of using memory past the end of the vector, which would be another indication that not reserve(..)ing and not using push_back(..) is the most likely cause here.