QR Module of Eigen library is not found, where do I need to alter the Cmake.txt
Hy everybody,
I am currently writing a function for a ros node. During this calculation I am trying to use the pseudo inverse of the QR Module of Eigen. But unfortunately it is not able to find the include and by that not the function. I think I need to alter my Cmake file. I did already use normal <eigen eigen=""> functions so this is not the problem.
I found a stack overflow post in which it seems very easy to use the function. Just for clarity I add the link here: stack overflow post
Thank you very much for your help. Since I am not posting very often just tell me when I need to change anything. I will add all the information as soon as possible.
The code I am trying to make run:
#include <cv_bridge/cv_bridge.h>
#include "ros/ros.h"
#include <opencv2/highgui/highgui.hpp>
#include <algorithm>
#include <stdio.h>
#include <Eigen/Eigen>
#include <Eigen/QR> //<- can't find this import
void calc_delta_p(Eigen::Matrix <double,1,6> &delta_p,Eigen::Matrix <double,6,6> &hessian){
hessian.completeOrthogonalDecomposition().pseudoInverse(); //<-cant find this function
delta_p=hessian*delta_p;
}
The compiler throws this error:
/home/catkin_ws/src/image_publisher/src/function_file.cpp:120:13: error: ‘class Eigen::Matrix<double, 6, 6, 0, 6, 6>’ has no member named ‘completeOrthogonalDecomposition’
hessian.completeOrthogonalDecomposition().pseudoInverse();
Here is my cmake file:
cmake_minimum_required(VERSION 2.8.3)
project(image_publisher)
## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
cv_bridge
#opencv2
roscpp
sensor_msgs
std_msgs
cmake_modules #eigen
dynamic_reconfigure
message_generation
)
## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)
## Generate messages in the 'msg' folder
add_message_files(
FILES
sixDOF.msg
)
## Generate added messages and services with any dependencies listed here
generate_messages(
DEPENDENCIES
sensor_msgs
std_msgs
)
## Generate dynamic reconfigure parameters in the 'cfg' folder
generate_dynamic_reconfigure_options(
cfg/dynamic_reconfigure_file.cfg
)
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if your package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need catkin_package( INCLUDE_DIRS include
# LIBRARIES image_publisher CATKIN_DEPENDS cv_bridge roscpp sensor_msgs std_msgs dynamic_reconfigure message_runtime
#opencv2
# DEPENDS system_lib DEPENDS Eigen #Eigen library )
###########
## Build ##
###########
find_package(OpenCV) find_package(Eigen REQUIRED)
#eigenlibrary
set( PROPRIETARY_FUNCTIONS_H include/image_publisher/function_file.h )
set( PROPRIETARY_FUNCTIONS_CPP src/function_file.cpp )
## Specify additional locations of header files
## Your package locations should be listed before other locations include_directories( include ${catkin_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} ${Eigen_INCLUDE_DIRS}
# ${PROPRIETARY_FUNCTIONS_CPP}
# ${PROPRIETARY_FUNCTIONS_H} )
## Declare a C++ library
# add_library(${PROJECT_NAME}
# src/${PROJECT_NAME}/image_publisher.cpp
# )
#always before add dependencies
## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide add_executable(image_publisher_node src/image_publisher_node.cpp ${PROPRIETARY_FUNCTIONS_CPP} ${PROPRIETARY_FUNCTIONS_H} ) add_executable(image_subscriber_node src/image_subscriber_node ...