Deployment on RT-LAB/OPAL-RT

Hi :wave:

I am using ACADOS with Simulink (s-function) for an MPC problem. The ACADOs files run and work very will with Matlab, Simulink Normal run, and Simulink Accelerator run. Next step is to build and run the model on OPAL-RT target machine.

I am encountering this problem which maybe relating to the Linker when the system build in RT-LAB/OPAL-RT system.

========================================================================
-------------------- Building benchmark_mpc_1_sm_model --------------------

  rm -f benchmark_mpc_1_sm_model
  ### Linking ...
  opicpc  -Wl,-rpath='/usr/opalrt/v2024.1.2.43/common/bin' -Wl,'-rpath=/usr/opalrt/v2024.1.2.43/common/bin/x32' -Wl,-rpath='/opt/intel/composerxe/lib/ia32' -Wl,-rpath='/opt/intel/Compiler/11.1/072/lib/ia32' -Wl,-rpath='/opt/intel/Compiler/11.1/056/lib/ia32' -diag-disable remark -L. -L/usr/opalrt/v2024.1.2.43/RT-LAB/lib -L/usr/opalrt/v2024.1.2.43/common/lib -L/usr/opalrt/v2024.1.2.43/common/lib/redhawk -L/usr/opalrt/v2024.1.2.43/common/bin -L/usr/opalrt/v2024.1.2.43/common/bin/x32 -L/usr/opalrt/externals/lib    -o benchmark_mpc_1_sm_model acados_solver_sfunction_PowerSystemBESS.o benchmark_mpc_1_sm_model.o benchmark_mpc_1_sm_model_data.o benchmark_mpc_1_sm_model_offsets.o model_main.o rtGetInf.o rtGetNaN.o rt_logging.o rt_nonfinite.o rt_printf.o rt_sim.o      -lRTLABSimCore -lSimCoreLib -lSyncExchangerLib -lConnectionLib -lConnectionFactoryLib  -lOpalSfunR2023B -lOpalR2023B -lBlocksRT-2023b -ldspR2023B -lsimscapeR2023B -lSimulinkRT-2023b -lOpalRTER2023B -lOpalCore -lOpalCore -lLicenseLib -lSimulink -lSimulationUtilities -lInfrastructure  -lNetwork -lKLU -lNumeric -lFramework -lSystem -lMatio -luuid -lpthread -lRTLABSimCore -lSimCoreLib -lSyncExchangerLib -lConnectionLib -lConnectionFactoryLib -lOpalHttpLicenseRequest -lRapidJSON_Wrapper -lOpalUtils -lOpalAscii -lOpalComm -lOpalConfigFiles -lOpalCPU -lOpalEnv -lOpalFiles -lOpalList -lOpalMemLock -lOpalOSIdentification -lOpalPyTestUtils -lpthread -lm -ldl -lutil -lrt      /usr/matlab/v23.2/rtw/c/libsrc/rtwlibr_redhawk.a 
  acados_solver_sfunction_PowerSystemBESS.o: In function `mdlStart':
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x2): undefined reference to `PowerSystemBESS_acados_create_capsule'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0xa): undefined reference to `PowerSystemBESS_acados_create'
  acados_solver_sfunction_PowerSystemBESS.o: In function `mdlOutputs':
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x3a): undefined reference to `PowerSystemBESS_acados_get_nlp_config'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x45): undefined reference to `PowerSystemBESS_acados_get_nlp_dims'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x52): undefined reference to `PowerSystemBESS_acados_get_nlp_in'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x5d): undefined reference to `PowerSystemBESS_acados_get_nlp_out'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x6d): undefined reference to `PowerSystemBESS_acados_get_nlp_solver'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0xc4): undefined reference to `ocp_nlp_constraints_model_set'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x117): undefined reference to `ocp_nlp_constraints_model_set'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x146): undefined reference to `ocp_nlp_cost_model_set'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x1b9): undefined reference to `ocp_nlp_cost_model_set'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x21c): undefined reference to `ocp_nlp_cost_model_set'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x278): undefined reference to `ocp_nlp_cost_model_set'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x2d4): undefined reference to `ocp_nlp_cost_model_set'
  acados_solver_sfunction_PowerSystemBESS.o:acados_solver_sfunction_PowerSystemBESS.c:(.text+0x333): more undefined references to `ocp_nlp_cost_model_set' follow
  acados_solver_sfunction_PowerSystemBESS.o: In function `mdlOutputs':
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x659): undefined reference to `ocp_nlp_dims_get_from_attr'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x6a2): undefined reference to `ocp_nlp_constraints_model_set'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x6e6): undefined reference to `ocp_nlp_dims_get_from_attr'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x72f): undefined reference to `ocp_nlp_constraints_model_set'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x775): undefined reference to `ocp_nlp_constraints_model_set'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x7a4): undefined reference to `ocp_nlp_constraints_model_set'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x7d3): undefined reference to `ocp_nlp_cost_model_set'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x814): undefined reference to `ocp_nlp_cost_model_set'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x858): undefined reference to `ocp_nlp_cost_model_set'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x883): undefined reference to `PowerSystemBESS_acados_reset'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x8b6): undefined reference to `ocp_nlp_dims_get_from_attr'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x902): undefined reference to `ocp_nlp_out_set'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x922): undefined reference to `PowerSystemBESS_acados_solve'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x939): undefined reference to `ocp_nlp_get'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x966): undefined reference to `ocp_nlp_out_get'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x985): undefined reference to `ocp_nlp_get_all'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x9a4): undefined reference to `ocp_nlp_get_all'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x9db): undefined reference to `ocp_nlp_eval_cost'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0x9ed): undefined reference to `ocp_nlp_get'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0xa08): undefined reference to `ocp_nlp_get'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0xa1d): undefined reference to `ocp_nlp_get'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0xa2f): undefined reference to `ocp_nlp_get'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0xa41): undefined reference to `ocp_nlp_get'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0xa65): undefined reference to `ocp_nlp_out_get'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0xa9d): undefined reference to `ocp_nlp_get'
  acados_solver_sfunction_PowerSystemBESS.o: In function `mdlTerminate':
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0xacb): undefined reference to `PowerSystemBESS_acados_free'
  acados_solver_sfunction_PowerSystemBESS.c:(.text+0xad1): undefined reference to `PowerSystemBESS_acados_free_capsule'
  make: *** [benchmark_mpc_1_sm_model] Error 1
  ??? Error building benchmark_mpc_1_sm_model subsystem.

========================================================================

Anyone know how to solve this? Anyone now how to add the ACADOs lib files to the linker if this is the problem?

Thanks in advance and appreciate your help!

Hi :wave:

the error indeed looks like you are missing the acados core library as well as the solver-specific code.

Did you manage to cross-compile acados for your target system? Did you check the embedded workflow documented here, I guess you will need to follow similar steps.

Hi,

Thank you for highlighting this to me. I will check the page and try to apply the same on OPAL-RT instead of dSPACE if applicable.

Best Regards

Great, let me know how it goes! :rocket: We would be happy to include additional instructions on the docs pages regarding deployment on OPAL-RT.