tuw-robotics / tuw_multi_robot

BSD 3-Clause "New" or "Revised" License
242 stars 113 forks source link

Eigen Alignment Issues #3

Closed wzli closed 2 years ago

wzli commented 5 years ago

Hi,

Just wanted to point out a bug that can lead to issues down the road. While looking through the router implementation it seems std::vectors of Eigen::Vectors are extensively used. For example the Segment and Checkpoint classes defined in https://github.com/tuw-robotics/tuw_multi_robot/blob/master/tuw_multi_robot_router/include/tuw_global_router/srr_utils.h and https://github.com/tuw-robotics/tuw_multi_robot/blob/master/tuw_multi_robot_router/include/tuw_global_router/mrr_utils.h. There is documentation regarding memory alligentment problems that commonly arise in this scenerio https://eigen.tuxfamily.org/dox/group__TopicStlContainers.html The solution is mentioned in the link, and involves using a custom allocator for the container eg: std::vector<Eigen::Vector3f,Eigen::aligned_allocator> instead of std::vector

As is, it is highly likely to run into such issues at some point, especially when compiling for other OS and processor architectures.

maxbader commented 5 years ago

We know, but at the moment I do not have the resources. But I will come back to that issue