Problem with passing parameters into system model

Hi everyone,

Thanks for developing this toolbox! I’m currently using acados through the MATLAB interface, and am facing issues when I try to pass a vectorial parameter into the system model. I’ve attached some test code to show what I mean.

The attached code implements a simple 3D kinematics model: the agent can move freely in 3D space, but must remain within the conical field-of-view of some cameras on the ground. At first, I hard-coded the camera position inside the dynamics model, and the optimization went well. However, when I tried to pass in the camera position as a model parameter - using the same position value - the NLP solver immediately failed with error status 4. Even so, the solver and sim models still compiled successfully.

In the code, you should be able to reproduce this issue by replacing lines 11-12 with line 10 in debug_model.m:

10  % cam_pos = [0;0;0.1];
11  sym_p = SX.sym('pm',3*num_cams,1);
12  cam_pos = reshape(sym_p,3,num_cams);

My apologies if the issue turns out to be trivial, and thank you in advance!


Hi Jon,

you forgot to set the parameter values at the terminal stage, i.e.

ocp.set('p', [0, 0, 0.1], ocp_N);