robotology / osqp-eigen

Simple Eigen-C++ wrapper for OSQP library
https://robotology.github.io/osqp-eigen/
BSD 3-Clause "New" or "Revised" License
381 stars 112 forks source link

no members matching ‘Eigen::TriangularView<const Eigen::SparseMatrix<double, 0, int>, #119

Closed SkelonChan closed 2 years ago

SkelonChan commented 2 years ago

when i use the ospqeigen in ros,to solve qp problem,it occured error Eigen::SparseMatrix<double> hh; hh.resize(6,6); hh.insert(0,0) = 1; hh.insert(1,0) = 1; .... hh.insert(1,5) = 1; hh.insert(2,5) = 1; hh.insert(3,5) = 1; hh.insert(4,5) = 1; hh.insert(5,5) = 1; solver.data()->setHessianMatrix(hh); solver.data()->setGradient(gradient); solver.data()->setLinearConstraintsMatrix(linearMatrix); solver.data()->setLowerBound(lowerBound); solver.data()->setUpperBound(upperBound);

when i compile it ,it will take a error such as: [ 96%] Built target vehicle_info_msg_generate_messages In file included from /usr/local/include/eigen3/Eigen/Core:328, from /usr/local/include/eigen3/Eigen/Dense:1, from /home/skelon/demo/MPC_ros/src/mpc_fid/src/mpc_ros.cpp:7: /usr/local/include/eigen3/Eigen/src/Core/TriangularMatrix.h: In instantiation of ‘class Eigen::TriangularView<const Eigen::SparseMatrix<double, 0, int>, 2>’: /usr/local/include/OsqpEigen/Data.tpp:38:13: required from ‘bool OsqpEigen::Data::setHessianMatrix(const Eigen::SparseCompressedBase<Derived>&) [with Derived = Eigen::SparseMatrix<double, 0, int>]’ /home/skelon/demo/MPC_ros/src/mpc_fid/src/mpc_ros.cpp:608:39: required from here /usr/local/include/eigen3/Eigen/src/Core/TriangularMatrix.h:295:17: error: no members matching ‘Eigen::TriangularView<const Eigen::SparseMatrix<double, 0, int>, 2>::Base {aka Eigen::TriangularViewImpl<const Eigen::SparseMatrix<double, 0, int>, 2, Eigen::Sparse>}::solve’ in ‘Eigen::TriangularView<const Eigen::SparseMatrix<double, 0, int>, 2>::Base’ {aka ‘class Eigen::TriangularViewImpl<const Eigen::SparseMatrix<double, 0, int>, 2, Eigen::Sparse>’} 295 | using Base::solve;

when i commented out the code solver.data()->setHessianMatrix(hh); it whill compile ok.

traversaro commented 2 years ago

Hi @SkelonChan, did you solved the problem? If that is the case, it may be convenient if you share your solution, to avoid situations such as https://xkcd.com/979/ . :D

SkelonChan commented 2 years ago

the reason is Header file conflict,too difficult to find it

traversaro commented 2 years ago

Ok, thanks anyway!

Bzdss6 commented 4 months ago

the reason is Header file conflict,too difficult to find it

I'm also having the same issue, where exactly is the conflict happening?

traversaro commented 4 months ago

the reason is Header file conflict,too difficult to find it

I'm also having the same issue, where exactly is the conflict happening?

@Bzdss6 I suggest to open a new issue with a clear description of your setup. Commenting a closed issue is not great for visibility.