non-HPIPM solvers not found when building C++ using C interface

Hi! I am using the C interface in C++ to make a ROS package. When I try to build my package, it only succeeds when I have generated c-code using the HPIPM solver. Other solvers such as OSQP, DAQP, QPOASES result in the build failing:

Errors     << ctl_mpc:make /home/jonne/astrobee/log/ctl_mpc/build.make.053.log                  
/home/jonne/astrobee/src/gnc/ctl_acados_mpc/solver/c_generated_code/acados_solver_astrobee.c: In function ‘astrobee_acados_create_1_set_plan’:
/home/jonne/astrobee/src/gnc/ctl_acados_mpc/solver/c_generated_code/acados_solver_astrobee.c:146:53: error: ‘FULL_CONDENSING_QPOASES’ undeclared (first use in this function); did you mean ‘FULL_CONDENSING_HPIPM’?
  146 |     nlp_solver_plan->ocp_qp_solver_plan.qp_solver = FULL_CONDENSING_QPOASES;
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~
      |                                                     FULL_CONDENSING_HPIPM
/home/jonne/astrobee/src/gnc/ctl_acados_mpc/solver/c_generated_code/acados_solver_astrobee.c:146:53: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [CMakeFiles/ctl_mpc_lib.dir/build.make:356: CMakeFiles/ctl_mpc_lib.dir/solver/c_generated_code/acados_solver_astrobee.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:2193: CMakeFiles/ctl_mpc_lib.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

I did install acados with these solvers, they also show up in acados/build/external. Therefore, my best guess that I might not be linking these solvers correctly in my CMakeLists:

set(acados_include ${PROJECT_SOURCE_DIR}/acados/include)
set(acados_lib ${PROJECT_SOURCE_DIR}/acados/lib)
set(solver_code ${PROJECT_SOURCE_DIR}/solver/c_generated_code)

catkin_package(
  INCLUDE_DIRS   
    ${acados_include}/blasfeo/include/
    ${acados_include}/hpipm/include/
    ${acados_include}/
    ${acados_include}/daqp/
    ${acados_include}/qpOASES_e/
    ${acados_include}/osqp/
    ${acados_include}/../
    ${solver_code}
    ${catkin_INCLUDE_DIRS}
  CATKIN_DEPENDS
    roscpp
    ff_msgs
    ff_util
)

include_directories(
# include
  ${acados_include}/blasfeo/include/
  ${acados_include}/hpipm/include/
  ${acados_include}/
  ${acados_include}/daqp/
  ${acados_include}/qpOASES_e/
  ${acados_include}/osqp/
  ${acados_include}/../
  ${solver_code}
  ${catkin_INCLUDE_DIRS}
)

link_directories(
  ${acados_lib}
)

But I did the same here for HPIPM as for the other solvers. Any idea what could be causing this issue? The full structure of the package can be found here: https://github.com/DISCOWER/ctl_acados_mpc

Thanks!

Hi,

the Github link you posted is not accessible.

However, the issue you have is probably because the external solver specific flags are missing.

Good luck!

Jonathan

1 Like

Thank you very much! This solved my problem :smile:

Translated to my CMakeLists, I just had to add the flags in add_compile_options():

add_compile_options(-std=c++11 -DACADOS_WITH_DAQP -DACADOS_WITH_OSQP)
1 Like