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

Pcl error in stl container

asked 2012-12-13 04:35:12 -0600

jcc gravatar image

updated 2016-10-24 09:01:21 -0600

ngrennan gravatar image


I'm using ROS fuerte with Ubuntu 11.10 and i'm having a problem with pcl. I'm geting a PointCloud from the kinect and later on the program i'm putting that in a std::deque.

But sometimes this gives me an error.

kinect_track: /usr/include/eigen3/Eigen/src/Core/DenseStorage.h:69: Eigen::internal::plain_array<T, Size, MatrixOrArrayOptions, 16>::plain_array() [with T = float, int Size = 4, int MatrixOrArrayOptions = 0]: Assertion `(reinterpret_cast<size_t>(array) & 0xf) == 0 && "this assertion is explained here: " "" " **** READ THIS WEB PAGE !!! ****"' failed.

Acording to the that page the problem is that the deque(PointCloud) must be aligned according to the eigen files. The PCL 1.5.1 in the file point_types.cpp shows that the PointXYZRGB is aligned

00351   {
00352     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
00353     union
00354     {
00355       union
00356       {
00357         struct
00358         {
00359           uint8_t b;
00360           uint8_t g;
00361           uint8_t r;
00362           uint8_t _unused;
00363         };
00364         float rgb;
00365       };
00366       uint32_t rgba;
00367     };
00370   };

but the PCL 1.5 that comes with ROS on the same file (but .h) have (line 299):

    (float, x, x)
    (float, y, y)
    (float, z, z)
    (float, rgb, rgb)

only and no


anywhere in the file.

this is my code:

typedef pcl::PointCloud<pcl::PointXYZRGB> PointCloud;
namespace enc = sensor_msgs::image_encodings;

using namespace cv;
using namespace std;

deque(PointCloud) PC;

(and later)

void GetFeaturePoints::NewImage(const PointCloud::ConstPtr& msg){

Can i do anything to this?

it's the same error as (this)


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-12-13 09:08:32 -0600

I believe the pointcloud is properly aligned, but not the container holding the point clouds.

Let's assume you have a point cloud of type PointCloud. Initializaing a std::vector like this will cause alignemnet errors:

std::vector<PointCloud> my_deque;

The proper way to initialize is:

std::vector<PointCloud, Eigen::aligned_allocator<PointCloud> > my_deque;

I assume the same holds for other types of stl containers, such as a deque. More information here

edit flag offensive delete link more


Great! the problem is gone! Thanks

jcc gravatar image jcc  ( 2012-12-26 05:40:36 -0600 )edit

Question Tools


Asked: 2012-12-13 04:35:12 -0600

Seen: 896 times

Last updated: Dec 13 '12