Change qp solver error

Hi,
I’ve generated C code from Python interface.

I want to change the qp solver .
I change the qp_solver =‘PARTIAL_CONDENSING_OSQP’ in python file, it can run successfully, and generate c code.
But when I use C++ to call c_generate_code to solve ocp, i get an error:
error: " c_generated_code/acados_solver_mobile_robot.c:115:53: error: ‘PARTIAL_CONDENSING_OSQP’ undeclared (first use in this function); did you mean ‘PARTIAL_CONDENSING_HPIPM’?"

When i running Python code, the terminal Displaying these information:

( cd mobile_robot_model ; gcc -fPIC -std=c99    -DACADOS_WITH_OSQP -c  mobile_robot_expl_ode_fun.c mobile_robot_expl_vde_forw.c)
gcc -fPIC -std=c99    -DACADOS_WITH_OSQP -c acados_sim_solver_mobile_robot.c -I /home/zhangrongshen/nolinear_solver/ACADOS_/acados/include/blasfeo/include/ -I /home/zhangrongshen/nolinear_solver/ACADOS_/acados/include/hpipm/include/ \
-I /home/zhangrongshen/nolinear_solver/ACADOS_/acados/include -I /home/zhangrongshen/nolinear_solver/ACADOS_/acados/include/acados/ \

gcc -fPIC -std=c99    -DACADOS_WITH_OSQP -shared -o libacados_sim_solver_mobile_robot.so  acados_sim_solver_mobile_robot.o  mobile_robot_model/mobile_robot_expl_ode_fun.o mobile_robot_model/mobile_robot_expl_vde_forw.o -L -l \
-L /home/zhangrongshen/nolinear_solver/ACADOS_/acados/lib -lacados -lhpipm -lblasfeo \

I guess there may be an error here, but I don’t know how to modify it. . . . .

(I installed it according to the steps on the official website, and I also installed the OSQP library.)

Thanks in advance

Hi,

I guess the compilation command in Python, i.e. the one you included is not the problem, because it works from Python.

How do you compile your C++ project?
Maybe a flag like -DACADOS_WITH_OSQP should be included in that compilation command.

Cheers,
Jonathan

Hi Jonathan,

Thanks for your help. When install acados, i have made -DACADOS_WITH_OSQP=ON.

I created a test file by myself, including a python file and a c file. I created the mpc model and the optimization problem in mobile_robot_model.py and mobile_robot_opt.py.

And i create the main function incluude c_genrated_code file in mobile_robot_app.cpp and mobile_robot_app.h, and then use cmake and make to compile.

When qp_solver=‘PARTIAL_CONDENSING_HPIPM’ in mobile_robot_opt.py , the c file can be complied successfully, but when it change to other qp_solver, the c file compile falied with the mess:

I have tried reinstallation and some other attempts, but none of them worked.
So do u have any suggestion to solve the problem? Thank u…