Execute main.py in generic_dyn_disc under Windows

Hi :wave:

I am currently facing an execution error. I built acados under Windows according to the tutorial Installation — acados documentation, but the following problem occurred when executing main.py under the generic_dyn_disc file:

Traceback (most recent call last):
  File "D:\anaconda3\envs\pytorch2_0\acados\examples\acados_python\generic_dyn_disc\main.py", line 258, in <module>
    main()
  File "D:\anaconda3\envs\pytorch2_0\acados\examples\acados_python\generic_dyn_disc\main.py", line 228, in main
    status = ocp_solver.solve()
  File "d:\anaconda3\envs\pytorch2_0\acados\interfaces\acados_template\acados_template\acados_ocp_solver.py", line 394, in solve
    self.status = getattr(self.shared_lib, f"{self.name}_acados_solve")(self.capsule)
OSError: exception: access violation reading 0xFFFFFFFFFFFFFFFF

Has anyone encountered similar problems? How did you solve them?

Best
Tom

I solved the problem by commenting the free function. But when I ran it later, I wrote the output log on the

static void mass_spring_system(double Ts, int nx, int nu, double *A, double *B, double *b)
int disc_dyn_fun_jac_hess(void **in, void **out, void *params)
int disc_dyn_fun_jac(void **in, void **out, void *params)
int disc_dyn_fun(void **in, void **out, void *params)

found that the disc_dyn_fun dynamic equation did not seem to be executed in the control cycle. According to the configuration, the functions for solving hess and jac were always executed.Why does this effect occur? Is it that the Jacbian matrix is ​​enough without state transfer?

Hi Tom,

I tried to run the example on Linux and also used valgrind on the generated code.
I did not find any issues on my machine.
I used the latest commit on the master branch e0463dd81.

To clarify your second question: disc_dyn_fun_jac returns the function and jacobian.
These two are typically needed together in SQP. Thus, this function is called most often.
The function disc_dyn_fun only returns the function value.
The most common case where this is used is in merit backtracking based globalization.

Best,
Jonathan