Skip to content

Commit

Permalink
replace the depricated solve() by solveProblem()
Browse files Browse the repository at this point in the history
  • Loading branch information
VenusPasandi committed Oct 20, 2022
1 parent b31a26e commit f7fbf5b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions toolbox/library/src/OSQP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,21 +586,20 @@ bool wbt::block::OSQP::output(const BlockInformation* blockInfo)
}
}

bool solveReturnVal = pImpl->sqSolver->solve();
OsqpEigen::ErrorExitFlag solveReturnVal = pImpl->sqSolver->solveProblem();

if (pImpl->stopWhenFails && !solveReturnVal) {
bfError << "OSQP: solve() failed.";
if (pImpl->stopWhenFails && solveReturnVal != OsqpEigen::ErrorExitFlag::NoError) {
bfError << "OSQP: solveProblem() failed.";
return false;
}

// Get outputs
if (solveReturnVal) {
if (solveReturnVal == OsqpEigen::ErrorExitFlag::NoError) {
solution_colMajor = pImpl->sqSolver->getSolution();
}

// Set status
double status = solveReturnVal ? 0 : 1;
if (!statusSignal->set(0, status)) {
if (!statusSignal->set(0, double(solveReturnVal))) {
bfError << "Failed to set status signal.";
return false;
}
Expand Down

0 comments on commit f7fbf5b

Please sign in to comment.