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

Pcl error in stl container

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

jcc gravatar image

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

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 -0500

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 image jcc  ( 2012-12-26 05:40:36 -0500 )edit

Question Tools

Stats

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

Seen: 899 times

Last updated: Dec 13 '12