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

Eigen libriary does not work

asked 2015-08-12 02:21:32 -0600

soheilred gravatar image

hi guys,

I am working on Indigo installed on Ubuntu 14.04. I want to use Eigen library in my code. I used this tutorial to add the library to my codes. I also checked this one. After following these two tutorials, my package.xml contains:

<build_depend>cmake_modules</build_depend>
<run_depend>cmake_modules</run_depend>

and my CMakeLists.txt has these lines:

find_package(catkin REQUIRED COMPONENTS cmake_modules )
find_package(Eigen REQUIRED)
catkin_package(
  INCLUDE_DIRS include
  LIBRARIES talker1
  CATKIN_DEPENDS roscpp rospy std_msgs geometry_msgs nav_msgs tf cmake_modules
  DEPENDS Eigen
)
add_executable(CRControl1 src/CRControl1.cpp)
add_dependencies(CRControl1 beginner_tutorials_generate_messages_cpp)
target_link_libraries(CRControl1 ${catkin_LIBRARIES} ${EIGEN_LIBRARIES})

But unfortunately, non of them worked. when I am trying to compile, I get this error:

/usr/include/eigen3/Eigen/src/Cholesky/LDLT.h:52:40: error: ‘RowMajorBit’ was not declared in this scope
       Options = MatrixType::Options & ~RowMajorBit, // these are the options for the TmpMatrixType, we need a ColMajor matrix here!
In file included from /home/soheil/catkin_ws/src/talker1/src/CRControl1.h:31:0,
                 from /home/soheil/catkin_ws/src/talker1/src/CRControl1.cpp:1:
/usr/include/eigen3/Eigen/src/Cholesky/LDLT.h:58:22: error: expected nested-name-specifier before ‘NumTraits’
     typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
                      ^
/usr/include/eigen3/Eigen/src/Cholesky/LDLT.h:58:22: error: expected ‘;’ at end of member declaration
/usr/include/eigen3/Eigen/src/Cholesky/LDLT.h:58:31: error: expected unqualified-id before ‘<’ token
     typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
                               ^
/usr/include/eigen3/Eigen/src/Cholesky/LDLT.h:60:13: error: ‘Matrix’ does not name a type
     typedef Matrix<Scalar, RowsAtCompileTime, 1, Options, MaxRowsAtCompileTime, 1> TmpMatrixType;
             ^
/usr/include/eigen3/Eigen/src/Cholesky/LDLT.h:62:13: error: ‘Transpositions’ does not name a type
     typedef Transpositions<RowsAtCompileTime, MaxRowsAtCompileTime> TranspositionType;
             ^
/usr/include/eigen3/Eigen/src/Cholesky/LDLT.h:63:13: error: ‘PermutationMatrix’ does not name a type
     typedef PermutationMatrix<RowsAtCompileTime, MaxRowsAtCompileTime> PermutationType;
             ^
/usr/include/eigen3/Eigen/src/Cholesky/LDLT.h:125:18: error: ‘TranspositionType’ does not name a type
     inline const TranspositionType& transpositionsP() const
                  ^
/usr/include/eigen3/Eigen/src/Cholesky/LDLT.h:132:12: error: ‘Diagonal’ does not name a type
     inline Diagonal<const MatrixType> vectorD() const
            ^
/usr/include/eigen3/Eigen/src/Cholesky/LDLT.h:175:18: error: ‘solve_retval’ in namespace ‘Eigen::internal’ does not name a type
     inline const internal::solve_retval<LDLT, Rhs>
                  ^
/usr/include/eigen3/Eigen/src/Cholesky/LDLT.h:194:23: error: ‘MatrixBase’ has not been declared
     bool solveInPlace(MatrixBase<Derived> &bAndX) const;
                       ^
/usr/include/eigen3/Eigen/src/Cholesky/LDLT.h:194:33: error: expected ‘,’ or ‘...’ before ‘<’ token
     bool solveInPlace(MatrixBase<Derived> &bAndX) const;
                                 ^
/usr/include/eigen3/Eigen/src/Cholesky/LDLT.h:199:28: error: ‘MatrixBase’ does not name a type
     LDLT& rankUpdate(const MatrixBase<Derived>& w, const RealScalar& alpha=1);
                            ^
/usr/include/eigen3/Eigen/src/Cholesky/LDLT.h:199:38: error: expected ‘,’ or ‘...’ before ‘<’ token
     LDLT& rankUpdate(const MatrixBase<Derived>& w, const RealScalar& alpha=1);
                                      ^
/usr/include/eigen3/Eigen/src/Cholesky/LDLT.h:221:5: error: ‘ComputationInfo’ does not name a type
     ComputationInfo info() const
     ^
/usr/include/eigen3/Eigen/src/Cholesky/LDLT.h:236:5: error ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2015-08-12 03:07:51 -0600

Simon Schmeisser gravatar image

updated 2015-08-12 03:08:44 -0600

well, it says matrix is an unknown type, so you probably need to include something containing the definition of matrix

#include <eigen3/Eigen/Eigen>

also potentially you want to add to your CMakeLists.txt:

include_directories(src ${EIGEN3_INCLUDE_DIR})

because then you can use

#include <Eigen/Eigen>

which works even on non-Ubuntu plattforms

edit flag offensive delete link more

Comments

thank you for your quick answer. but it still does not work. These things are happening even before I define any matrix or vectors. I get the error when I write the include line.

soheilred gravatar image soheilred  ( 2015-08-12 03:49:34 -0600 )edit
1

it looks a bit strange that your include contains a "src", is that really untented? maybe you want to include

 #include <eigen3/Eigen/Cholesky>

instead?

Simon Schmeisser gravatar image Simon Schmeisser  ( 2015-08-12 04:20:25 -0600 )edit

this is what Eclipse auto-completion gives to me. Otherwise, it shows the line with a red line beneath it as an error:

Unresolved inclusion error
soheilred gravatar image soheilred  ( 2015-08-12 06:07:33 -0600 )edit

the problem solved. you were right Simon. The inclusion command was not true. But, actually I cannot understand what's wrong with my Eclipse. I used this feature without any problem. But it seams that it cannot handle this library correctly. do you have any idea about the problem?

soheilred gravatar image soheilred  ( 2015-08-12 20:19:31 -0600 )edit

Eigen contains lot of template magic, maybe that breaks eclipse, but no, I have no idea actually ;)

Simon Schmeisser gravatar image Simon Schmeisser  ( 2015-08-13 08:00:58 -0600 )edit

It seems that problem has not been solved completely. When I could include the library into my code, I built my node without any problem. But now, when I want to run my node, I get this error: CRControl1: /usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:238: void Eigen::PlainObjectBase

soheilred gravatar image soheilred  ( 2015-08-18 20:56:57 -0600 )edit

.... (nbRows<=MaxRowsAtCompileTime)) && (!(ColsAtCompileTime==Dynamic && MaxColsAtCompileTime!=Dynamic) || (nbCols<=MaxColsAtCompileTime)) && nbRows>=0 && nbCols>=0 && "Invalid sizes when resizing a matrix or array."' failed.

soheilred gravatar image soheilred  ( 2015-08-18 20:58:29 -0600 )edit

i got the same problem. how did you solve it?

dmngu9 gravatar image dmngu9  ( 2016-01-05 00:41:26 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-08-12 02:21:32 -0600

Seen: 6,654 times

Last updated: Aug 12 '15