Hi!
Thank you for adding getters for slack variables for Matlab. As in the example, ~/acados/examples/acados_matlab_octave/getting_started/extensive_example_ocp.m the code for getting slack variable values looks like,
% get slack values
for i = 0:N-1
sl = ocp.get(‘sl’, i);
su = ocp.get(‘su’, i);
t = ocp.get(‘t’, i);
end
sl = ocp.get(‘sl’, N);
su = ocp.get(‘su’, N);
I am afraid that this is probably wrong, because the index in Matlab cannot start from 0
in the for loop. When I run the code, I get empty sl
and su
of dimension 0x1
. This is unusual for Matlab. Moreover, if you are running the loop to get slack values for the horizon, then it should be filled in a matrix instead of rewriting over the same variable sl
and su
. The correct code could look something like this in my opinion If n_executions>0
:
for i=1:n_executions
% get slack values
for i = 1:N-1
sl(:, i, n_executions) = ocp.get(‘sl’, i);
su(:, i, n_executions) = ocp.get(‘su’, i);
t(:, i, n_executions) = ocp.get(‘t’, i);
end
sl(:, N, n_executions) = ocp.get(‘sl’, N);
su(:, N, n_executions) = ocp.get(‘su’, N);end
One more thing, it is possible to get sl
and su
values individually. But we set values of only Z, z, Z_e and z_e
and not Z_l, Z_u, z_l, z_u ....
Should the dimension of Z
and Z_e
be adjusted according to sl
and su
or I am over-complicating this?
Does sl_e
and su_e
correspond to sl(N)
and su(N)
?
It would be really helpful if you can look into the issue. If there is something I misunderstood, then please guide me
Best,
Smit