Acados installation in Pycharm

Hi, I want to implement a NMPC in an embedded system and when I read about acados SW I thought that it is exactly what I need, Unfortunately so far I did not have success installing it under Ubuntu 19.10 using python acados_template. I tried first without Pycharm, just from terminal, but when I tried to run the example minimal_example_ocp.py it crashed. I have pytthon 3.7, so I downgraded it to 3.6 but still with no success. Would it be possible to install acados in Pycharm? This would make it much simpler. Maybe someone of you has already done it and could provide me with instructions on how to do that.
Thank you in advance for your support.

Hi, I reinstalled acados from scratch and ran example /examples/acados_python/pmsm_example/generate_c_code.py from terminal and this is the error I got

Any help please in fixing acados installation?
Many thanks

Hi @walter,

first, welcome to the Forum! :tada:

I am not sure about Pycharm, but since you also have a problem compiling it the standard way, lets try to fix that, maybe its the same problem with pycharm…

Can you check a few things:

  1. The .so files are there in acados/lib, i.e. libacados.so, libhpipm.so, libblasfeo.so?
  2. Did you use CMake or Make for the compilation?
  3. With CMake the HPIPM and BLASFEO target should be chosen automatically. With make you might have to change them. Did you?

Ubuntu version and Python version >= 3.5 should not be the problem.

Best,
Jonathan

Hi @walter,

Don’t know what you mean by installing it in Pycharm.
What worked for me was to follow the documentation but install the python interface into a conda environment which worked fine. Then attach that environment to your project and be sure to include the environment variables to the run configuration of the example you want to run.

Z.

Hi @FreyJo,

In acados/lib i have libacados.so, libblasfeo.so, libhpipm.so, libqpOASES_e.so and libqpOASES_e.so.3.1.

I used CMake for compilation.

With CMake I left it to choose automatically HPIPM and BLASFEO.

Thank you.
BR,
Walter

Did you also export LD_LIBRARY_PATH?

I just realized the installation instructions should be structured a bit better…
https://docs.acados.org/interfaces/#python-templates

Hi @FreyJo,

yes

BR,
Walter

Hi @FreyJo,

so far I ran examples from /acados/examples/acados_python/getting_started.
Could you pls indicate me the example to run after installation to check if everything works OK?
Thank you.

BR,
Walter

I would typically run the minimal_example_ocp.py
Do you also have the same undefined symbol error there?

Yes, I’ve got the same error.

Might it be a problem of paths? I am not expert of linux, I just use it mainly copying and pasting instructions. In acados_template instructions it says:

“Notice that, if you want to run the examples from a location that differs from ‘<acados_root>/interfaces/acados_template’ or you want the generated Makefile to refer to a specific path (e.g. when cross-compiling or compiling from a location different from the one where you generate the C code), you will have to adapt ‘ocp.acados_include_path’ and ‘ocp.acados_lib_path’ accordingly in the generating Python code.”

I don’t know what it means but I ran the example not from <acados_root>/interfaces/acados_template.

Thank you

BR,
Walter

Hi @FreyJo, @ZandorT,

I tried also installing Anaconda but I always get the same error with
ocp_solver = AcadosOcpSolver(ocp, json_file = ‘acados_ocp.json’)

OSError: /home/walter/acados/lib/libblasfeo.so: undefined symbol: kernel_sgemm_nt_4x4_lib4

BR,
Walter

I think there could be something wrong with the HPIPM & BLASFEO targets.
Can you try the following, namely recompiling with GENERIC and running a C example:

cd <acados_dir>
rm build/* -rf
cd build
cmake .. -DACADOS_WITH_QPOASES=ON -DACADOS_EXAMPLES=ON -DHPIPM_TARGET=GENERIC -DBLASFEO_TARGET=GENERIC
make -j4
make install -j4
# run a C example, e.g.:
./examples/c/sim_wt_model_nx6

If that works, also try the Python example.

This is outdated. I will update the instructions soon.

Cheers,
Jonathan

Hi @FreyJo,

I compiled it using gcc

Sorry but I think I missed some instruction in running a C program

BR,
Walter

Recompiling as I suggested should have compiled the examples into
<acados_root>/build/examples/c.
you can just execute them, no need to compile them again…

Yes the C file worked!!

The python example made progress but still stopped with an error after a matplotlib window popped up.

Thank you
BR,
Walter

I guess replacing the last line in the example with:
plot_pendulum(Tf/N, Fmax, simU, simX, latexify=False)
will fix this.

I am wondering what dependency you are missing though.
Maybe you dont have Latex installed?

It would be great to find what went wrong with the automatic target…
Maybe you can run the cmake without the Target flags again and paste the output somewhere.

I checked. Latex is not installed on my Ubuntu. Shall I install a particular version?

I will install on another Ubuntu virtual machine acados with cmake without target flags and let you know.

BR,
Walter

Actually I thought you are interested in seeing the output of cmake running on this Ubuntu installation. This is the output