Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catkin_make failing due to static_assert in Eigen #121

Closed
ShreyasManjunath opened this issue Dec 7, 2020 · 7 comments
Closed

catkin_make failing due to static_assert in Eigen #121

ShreyasManjunath opened this issue Dec 7, 2020 · 7 comments
Labels
bug Something isn't working compile User has trouble compiling on their own platform.

Comments

@ShreyasManjunath
Copy link

Hi,
Thank you for the development.
I am trying to compile openvins on ubuntu 18.04 but encountering the following error.

/usr/local/include/eigen3/Eigen/src/Core/util/StaticAssert.h:33:40: error: static assertion failed: YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX
#define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);
^
/usr/local/include/eigen3/Eigen/src/Core/util/StaticAssert.h:33:40: note: in definition of macro ‘EIGEN_STATIC_ASSERT’
#define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);
^~~~~~~~~~~~~
/usr/local/include/eigen3/Eigen/src/Core/Dot.h:74:3: note: in expansion of macro ‘EIGEN_STATIC_ASSERT_VECTOR_ONLY’
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
^
/usr/local/include/eigen3/Eigen/src/Core/util/StaticAssert.h:33:40: error: static assertion failed: YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX
#define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);
^
/usr/local/include/eigen3/Eigen/src/Core/util/StaticAssert.h:33:40: note: in definition of macro ‘EIGEN_STATIC_ASSERT’
#define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);
^~~~~~~~~~~~~
/usr/local/include/eigen3/Eigen/src/Core/Dot.h:75:3: note: in expansion of macro ‘EIGEN_STATIC_ASSERT_VECTOR_ONLY’
EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)

This error pops out due to a line in RosVisualizer.cpp in ov_msckf pkg.
Line 667
double ori_nees = 2*quat_diff.block(0,0,3,1).dot(covariance.block(0,0,3,3).inverse()*2*quat_diff.block(0,0,3,1));

Seems like Eigen::Matrix<double,4,1> quat_gt, quat_st, quat_diff; quat_diff is indeed a Matrix.

Does anyone had similar experience?
Thank you

Shreyas

@goldbattle goldbattle added the debugging Might be a bug, looking into the issue label Dec 8, 2020
@goldbattle
Copy link
Member

What version of Eigen3 are you linking against?

@ShreyasManjunath
Copy link
Author

Hi,

I use Eigen3 3.3.9 (Newest).

Regards,

Shreyas

@goldbattle
Copy link
Member

Were you able to address this issue?

@ShreyasManjunath
Copy link
Author

Hi,

Yes. Seems like open_vins is not compiling for Eigen 3.3.9.
I switched to Eigen 3.3.4 and was able to compile it.

Btw. Do you have any separate branch for OpenCV 4 support?

Thank you once again.

Shreyas Manjunath

@goldbattle
Copy link
Member

You can try out #117 as it should support v4.
Post in that PR if you run into any issues using the newer opencv (it should default to 4 if you have 3 and 4).

@hellovuong
Copy link

hellovuong commented Jun 30, 2021

I fixed the error use dot() method for matrix quat_diff in Eigen 3.3.9, I change line 615, from:
double ori_nees = 2 * quat_diff.block(0, 0, 3, 1).dot(covariance.block(0, 0, 3, 3).inverse() * 2 * quat_diff.block(0, 0, 3, 1));
to:
Eigen::Vector4d temp_vec = covariance.block(0, 0, 3, 3).inverse() * 2 * quat_diff.block(0, 0, 3, 1);
double ori_nees = 2 * quat_diff.adjoint()*temp_vec;
By instruction about Dot product in Eigen page

@goldbattle
Copy link
Member

PR #226 should address Eigen issue for newer versions.

@goldbattle goldbattle added bug Something isn't working and removed debugging Might be a bug, looking into the issue labels Feb 10, 2022
@goldbattle goldbattle added the compile User has trouble compiling on their own platform. label Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compile User has trouble compiling on their own platform.
Projects
None yet
Development

No branches or pull requests

3 participants