This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Migrating Eigen2 to Eigen3

Tags: None
(comma "," separated)
phil0stine
Registered Member
Posts
2
Karma
0

Migrating Eigen2 to Eigen3

Mon Jan 09, 2012 2:59 pm
Hi all

I am using ROS and trying to migrate a set of packages from http://www.thearmrobot.com/trac/wiki/ARMSimulatorInstallation
which are built for Eigen2, to Eigen3.

I have referenced the Eigen wiki page on the subject, and have successfully migrated all packages except one. The compile errors I get are below.

Any help is appreciated.

In file included from /usr/include/eigen3/Eigen/Core:299:0,
from /home/phil/devel/arm_simulator/stacks/darpa_arm_sim_servers/BarrettCompat/include/barrett/systems/../systems/../math/matrix.h:22,
from /home/phil/devel/arm_simulator/stacks/darpa_arm_sim_servers/BarrettCompat/include/barrett/systems/../systems/../units.h:123,
from /home/phil/devel/arm_simulator/stacks/darpa_arm_sim_servers/BarrettCompat/include/barrett/systems/../systems/wam_specs.h:4,
from /home/phil/devel/arm_simulator/stacks/darpa_arm_sim_servers/BarrettCompat/include/barrett/systems/exposed_output.h:39,
from /home/phil/devel/arm_simulator/stacks/darpa_arm_sim_servers/BarrettCompat/src/barrett/ExposedOutput-specializations.cpp:1:
/usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h: In static member function ‘static void Eigen::PlainObjectBase<Derived>::_check_template_params() [with Derived = Eigen::Matrix<double, 7, 1, 1, 7, 1>]’:
/usr/include/eigen3/Eigen/src/Core/Matrix.h:304:7: instantiated from ‘Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::Matrix(const Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>&) [with _Scalar = double, int _Rows = 7, int _Cols = 1, int _Options = 1, int _MaxRows = 7, int _MaxCols = 1, Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> = Eigen::Matrix<double, 7, 1, 1, 7, 1>]’
make[3]: Leaving directory `/home/phil/devel/arm_simulator/stacks/darpa_arm_sim_servers/BarrettCompat/build'
/home/phil/devel/arm_simulator/stacks/darpa_arm_sim_servers/BarrettCompat/include/barrett/systems/../systems/../math/detail/matrix-inl.h:145:23: instantiated from ‘barrett::math::Matrix<R, C, Units>::Matrix(const barrett::math::Matrix<R, C, Units>&) [with int R = 7, int C = 1, Units = barrett::units::JointPositions<7>, barrett::math::Matrix<R, C, Units> = barrett::math::Matrix<7, 1, barrett::units::JointPositions<7> >]’
make[2]: Leaving directory `/home/phil/devel/arm_simulator/stacks/darpa_arm_sim_servers/BarrettCompat/build'
/home/phil/devel/arm_simulator/stacks/darpa_arm_sim_servers/BarrettCompat/src/barrett/ExposedOutput-specializations.cpp:12:53: instantiated from here
make[1]: Leaving directory `/home/phil/devel/arm_simulator/stacks/darpa_arm_sim_servers/BarrettCompat/build'
/usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:615:7: error: ‘INVALID_MATRIX_TEMPLATE_PARAMETERS’ is not a member of ‘Eigen::internal::static_assertion<false>’
jitseniesen
Registered Member
Posts
204
Karma
2

Re: Migrating Eigen2 to Eigen3  Topic is solved

Mon Jan 09, 2012 5:02 pm
You are trying to instantiate the type Eigen::Matrix<double,7,1,1,7,1> or possibly Eigen::Matrix<double,7,1,1> as the 5th and 6th template parameter have their default value. The error message is trying to tell you that this is not a valid type in Eigen3.

The problem is the 4th template parameter. For matrices, it specifies amongst other whether the matrix is stored in column-major order (if 4th parameter = ColMajor = 0) or row-major order (if 4th parameter = RowMajor = 1). However, for vectors row-major and column-major are the same, so to prevent type proliferation we introduced the requirement that row vectors have RowMajor and column vectors have ColMajor. Your type Eigen::Matrix<double,7,1,1> is a column-vector, so it should have ColMajor, so the 4th parameter should be 0. This requirement is new in Eigen3.

If you want all your matrices to be row-major, then the usual method is to #define EIGEN_DEFAULT_TO_ROW_MAJOR before you #include any Eigen files. However, this may not be the best thing for you. Looking at the source at http://www.thearmrobot.com/trac/browser ... h/matrix.h , an alternative may be to change "Eigen::Matrix<double, R,C, Eigen::RowMajorBit>" to "Eigen::Matrix<double, R,C, (C==1 && R>1) ? Eigen::ColMajor : Eigen::RowMajor>" in lines 43 and 45.

There is some more information about storage orders in http://eigen.tuxfamily.org/dox-devel/To ... rders.html but that page does not mention the requirement about vectors.
phil0stine
Registered Member
Posts
2
Karma
0

Re: Migrating Eigen2 to Eigen3

Mon Jan 09, 2012 9:00 pm
Outstanding! Thanks for the information, and the explanation/suggestion to go with it.

It compiles fine, and I have yet to see any runtime issues.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]