Setup spatial model

Hi all,

I’m using the acados matlab interface for a heavy duty truck model. As a time dependent model is quite uncomfortable regarding vehicle trajectory planning I try setting a spatial model. Unfortunately acados get’s problems when I add the location dependency. I have reduced my model to velocity only:

v = SX.sym(‘v’);
x = vertcat( v );

vdot = SX.sym(‘vdot’);
x_dot = vertcat( vdot );

F_drive = SX.sym(‘F_drive’);
u = vertcat(F_drive);

dv = F_drive / (mass * v);

and restricted the velocity between 1 and 27 m/s, as well as the engine force between zero and a positive maximum. The initial velocity is 1, y and y_e are 25 m/s. Running this minimal model with a sqp-solver at standard settings results in solver error 4, which is a qp-error. This means the problem is misconditioned or not solvable. Can you help me fix this?

Thanks and cheers,
Max

Hi Max,

did you initialize the solver explicitly?
This can definitely help.
Also, the problem can be infeasible due to some constraints, which you could formulate as soft constraints.

Hi Jonathan,

thanks for your answer.
The solver is initialized explicitly. The System is not bounded besides the constraints on velocity and force.

Maybe it will help to find my mistake if you take a look at my minimal model.

Thanks and cheers
Max

What I mean with initialization is setting the initial guess of the SQP method.
For the states this can be done with:

ocp.set('init_x', ones(nx,N+1));

Which already seems to fix your issue.
Since you divide by the state in the model, the default (zeros) initialization is problematic.

Similarly multipliers, controls, and more can be initialized from maltab using the fields
“init_x, init_u, init_z, init_xdot, init_pi, init_lam”.

Cheers,
Jonathan

1 Like

This solved my problem!

Thanks a lot!