Ask Your Question
1

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

Hi,

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: " "http://eigen.tuxfamily.org/dox-devel/TopicUnalignedArrayAssert.html" " **** READ THIS WEB PAGE !!! ****"' failed.
    Aborted

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

struct EIGEN_ALIGN16 _PointXYZRGB
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     };
00368 
00369     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00370   };

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

POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGB,
    (float, x, x)
    (float, y, y)
    (float, z, z)
    (float, rgb, rgb)
)

only and no

EIGEN_MAKE_ALIGNED_OPERATOR_NEW

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){
....
PC.push_back(*msg);
}

Can i do anything to this?

it's the same error as http://answers.ros.org/question/10040/hand_interaction-unaligned-array-assertion/ (this)

thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

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

Comments

Great! the problem is gone! Thanks

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

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

Seen: 650 times

Last updated: Dec 13 '12