CIFASIS / dense-sptam

Dense S-PTAM
GNU General Public License v3.0
61 stars 17 forks source link

Error while launching kitti.launch #5

Closed dattadebrup closed 5 years ago

dattadebrup commented 5 years ago

I followed the instructions properly to install all the dependencies and I built it successfully using catkin_make inside a catkin workspace. But I am getting this strange Eigen error while running kitti.launch file against kitti_04.bag file -----------

[ INFO] [1561028434.806107483, 1385799339.734153456]: S-PTAM stereo node initialized. [ INFO] [1561028434.942196212, 1385799339.864982461]: DENSE node initialized. [ INFO] [1561028435.254461691, 1385799340.183758361]: init calib [ INFO] [1561028435.254682849, 1385799340.183758361]: baseline: 0.537151 [ INFO] [1561028435.269423387, 1385799340.183758361]: Trying to intialize map... [ INFO] [1561028435.286068723, 1385799340.183758361]: Map initialized with 149 points. nodelet: /usr/include/eigen3/Eigen/src/Core/CoreEvaluators.h:838: Eigen::internal::block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel, true>::block_evaluator(const XprType&) [with ArgType = const Eigen::Matrix<double, 4, 1>; int BlockRows = 4; int BlockCols = 1; bool InnerPanel = true; Eigen::internal::block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel, true>::XprType = Eigen::Block<const Eigen::Matrix<double, 4, 1>, 4, 1, true>]: Assertion ((size_t(block.data()) % (((int)1 >= (int)evaluator<XprType>::Alignment) ? (int)1 : (int)evaluator<XprType>::Alignment)) == 0) && "data is not aligned"' failed.

Can you please help me? Thanks in advance. @taihup

taihup commented 5 years ago

Hi dattadebrup, the error is related to Eigen library memory alignment. In general, this is an error that appear with newer Eigen versions. I think you have two options: (1) use an older Eigen Version (for example Eigen 3.2). (2) Modify the dense-sptam code following the instruction provided in https://eigen.tuxfamily.org/dox/group__TopicUnalignedArrayAssert.html tosolve this type of error

dattadebrup commented 5 years ago

Hi @taihup I tried downgrading the Eigen version but still it is showing the same error `path/to/eigen/Eigen/src/Core/DenseStorage.h:44: Eigen::internal::matrix_array<T, Size, MatrixOptions, Align>::internal::matrix_array() [with T = double, int Size = 2, int MatrixOptions = 2, bool Align = true]: Assertion(reinterpret_cast(array) & (sizemask)) == 0 && "this assertion is explained here: http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html READ THIS WEB PAGE !!! ****"' failed.

And I don't know which files to modify in the dense-sptam code. Can you please give me some hints? Thank you. P.S. I believe the error message is originated from the sptam node.

taihup commented 5 years ago

Hi dattadebrup, as I told you, you must follow the instructions depicted in https://eigen.tuxfamily.org/dox/group__TopicUnalignedArrayAssert.html. For example, in each class that has an Eigen member such as a matrix o vetor or something that contains an Eigen object, you must add EIGEN_MAKE_ALIGNED_OPERATOR_NEW in the class body, as is depicted in the link http://eigen.tuxfamily.org/dox-devel/group__TopicStructHavingEigenMembers.html

you can check where the error occurs using some prints (cout) or using the debugger gdb. Maybe that can help to understand what is going on.

It is possible that the sptam-node has the eigen problem. The Eigen issue may also happen in the S-PTAM original version.

jlblancoc commented 5 years ago

You can also just add -DEIGEN_DONT_VECTORIZE to CMAKE_CXX_FLAGS. Things will work a bit slower, but you should totally avoid that kind of errors.

Eigen and alignment is a slippery terrain... ;-)

taihup commented 5 years ago

@jlblancoc Is right that is another option.

@jlblancoc nice find you here :D

dattadebrup commented 5 years ago

Hi all, Finally it is working fine with Eigen version 3.2.10. I initially downagraded it to 3.2.2 and it was giving me some other"function not found" error. Thank you all for your support.

jlblancoc commented 5 years ago

Sure! I try to keep an eye on all of you ;-)