Closed NUDTUGVexplorer closed 4 years ago
Hi @NUDTUGVexplorer, can you give us some more information about your system? For example:
osqp-eigen
versionosqp
versioncmake
configurations?1.OS: ubuntu 14.04 LTS gcc version 4.8.4 2.osqp-eigen: I just git from your repo on March 1st, 2020. 3.osqp: OSQP v0.5.0 - Operator Splitting QP Solver
In order to fix the issue, I found some advise from the others.
So I change the code in Solver.cpp,
//m_settings = std::unique_ptr
m_settings = std::make_unique<OsqpEigen::Settings>();
m_data = std::make_unique<OsqpEigen::Data>();
Then it could be successfully compiled now. /osqp-eigen-master/build$ make Scanning dependencies of target OsqpEigen [ 25%] Building CXX object CMakeFiles/OsqpEigen.dir/src/Solver.cpp.o [ 50%] Linking CXX shared library lib/libOsqpEigen.so [100%] Built target OsqpEigen
Thanks!
make test, the results are as follows: Running tests... Test project /home/lxh/software/osqp-eigen-master/build Start 1: SparseMatrixTest 1/5 Test #1: SparseMatrixTest ................. Passed 0.01 sec Start 2: QPTest 2/5 Test #2: QPTest ...........................Exception: SegFault 0.12 sec Start 3: UpdateMatricesTest 3/5 Test #3: UpdateMatricesTest ...............Exception: SegFault 0.10 sec Start 4: MPCTest 4/5 Test #4: MPCTest ..........................Exception: SegFault 0.10 sec Start 5: MPCUpdateMatricesTest 5/5 Test #5: MPCUpdateMatricesTest ............Exception: SegFault 0.10 sec
20% tests passed, 4 tests failed out of 5
Total Test time (real) = 0.42 sec
The following tests FAILED: 2 - QPTest (SEGFAULT) 3 - UpdateMatricesTest (SEGFAULT) 4 - MPCTest (SEGFAULT) 5 - MPCUpdateMatricesTest (SEGFAULT) Errors while running CTest
Indeed, the reason is exactly this one:
/home/ugv/software/osqp-eigen-master/src/Solver.cpp:19:18: error: ‘make_unique’ is not a member of ‘std’
The make_unique
has been implemented in gcc starting from version 4.9.0: https://isocpp.org/blog/2014/04/gcc-4.9.0. I am afraid your compiler is not supported.
By commenting out the lines https://github.com/robotology/osqp-eigen/blob/master/src/Solver.cpp#L23-L24 you are not allocating the Settings
and Data
object, causing the segfault.
Thanks for your help. After I update the gcc and g++ version to be 4.9.4. Now it woks. I appreciate your kind help.
@S-Dafarra I am facing the same issue Segmentation fault (core dumped)
. I am using Ubuntu 18 with g++
and gcc
version 7.5.0
. I am compiled osqp
from source as described here.
The following lines execute with no errors:
//solver.settings()->setVerbosity(false);
qpSolver_.settings()->setWarmStart(true);
// set the initial data of the QP solver
qpSolver_.data()->setNumberOfVariables((num_of_states_+num_of_inputs_)*mpcWindow);
qpSolver_.data()->setNumberOfConstraints((2*num_of_states_+num_of_inputs_)*mpcWindow);
Eigen::SparseMatrix<double> hessian = hessian_.sparseView();
Eigen::SparseMatrix<double> Ac = Ac_.sparseView();
if(!qpSolver_.data()->setHessianMatrix(hessian)) return false;
if(!qpSolver_.data()->setGradient(gradient_)) return false;
if(!qpSolver_.data()->setLinearConstraintsMatrix(Ac)) return false;
if(!qpSolver_.data()->setLowerBound(lowerBounds_)) return false;
if(!qpSolver_.data()->setUpperBound(upperBounds_)) return false;
However, I get the segmentation fault error when the following is executed
qpSolver_.updateBounds(lowerBounds_, upperBounds_);
I made sure that dimensions of the matrices are correct.
What could be the issue?
Thanks in advance.
Can the OsqpEigen::Solver obj;
be a class member? It seems to ave an issue when I use it inside a class as a class member.
Problem is solved. It was a silly mistake that I didn't initSolver()
!
When I run the example MPCExample.cpp it has an error: Segmentation fault (core dumped). Then I debug the program, it shows the error in the following lines.
solver.settings()->setWarmStart(true);
how to solve the issue? Thanks a lot.