Using Generated Code on a Raspberry Pi - Shared Library Issue

Hello!

I am using the python interface to call c generated code on a raspberry pi (Ubuntu 22.04) for an autonomous steering controller. I was able to get the MPC working on my laptop, but when I attempt to call the code from the pi it does not locate the share library.

For the RPi, I compiled casadi from binaries (though it is not used) and call the c code with the following line:

acados_solver = AcadosOcpSolver(None,generate=False,build=False,json_file="acados_ocp.json")

which produces this error on the Pi:

error while loading shared libraries:libacados_ocp_solver_Dynamic_Bicycle.so: cannot open shared object file: No such file or directory

(This is from memory as the unit is still at the lab so wording may be slightly different)

A few details:

  • I used CMake to build Acados
  • Build Targets for both computers were set to “GENERIC” prior to building
  • Code still runs fine in the same script from the original build laptop
  • Paths in the acados_ocp.json were updated for the Pi

Can anyone shed some light onto why the shared library is not being detected?

Thank you!

Hi,

is the shared model library there?

I see you want to create the solver with

Hello,

Yes, the shared model library is in the location that was searched by Acados. Also, I forgot to mention but I did double check that the acados path and library path are correct. Could this be an issue of generating code on an x86 computer and trying to run on ARM?

I’m thinking about trying to target the specific architecture (A72) or try building with Make instead of CMake but not sure at this point.

Closing the loop on this. I misspoke in my reply as I had been using Make instead of CMake to generate the code. Using CMake with BUILD_ACADOS_OCP_SOLVER_LIB = ON fixes my issue as long as i remake the shared library onboard the Pi.