Hi
I am using the get_cost() method to retrieve the value of the cost function using the Matlab interface and I get unexpected results using both linear_ls and nonlinear_ls formulation, that is, the get_cost() returns a value that differs from the one computed externally, using the output trajectories.
In my case, in a simple closed loop simulation, the cost computed using get_cost() is not decreasing and it doesn’t even reach zero when the system reaches the reference, whereas the externally computed cost does.
My Vx and Vu matrices are structured as follow:
Vx = [eye(nx);
zeros(nu,nx);
vec_1bynx];
Vu = [zeros(nx,nu);
eye(nu);
vec_1bynu];
Vx_e = eye(nx);
I suspect (but not sure) that the issue is related to the computation of terminal cost.
On the opposite, the ext_cost option works fine.
Thanks for any help.