Hi @FreyJo ,
thank you very much for your help, I appreciate!
As you suggested, I open up a new topic refering to this one https://discourse.acados.org/t/evaluate-a-piecewise-polynomial-spline/
What I’m trying to do is the following:
My path planner that uses A* for example, computes an optimal path on a grid with a certain cell size and returns a vector of waypoints. Based on those waypoints I have to generate a trajectory (for position and orientation) that can be used as a reference for my MPC Controller. In my case, this is a simple Interpolation of the waypoints using splines.
My cost on the state would look like ||x_pred(k|t) - x_ref||²_Q with k = 0,…,N+1 and
x_ref being the evaluation of my predicted state using the Spline: x_ref = spline_fct(x_pred(k|t)).
Thats what I meant in the previous post with “… to get the tracking error”.
The question I am struggling with is, where do I create the splines? Creating it outside my S-Function would require the S-Function block to have an Input for functions. Right now, the y_ref and y_ref_e port of the S-Function only takes double values if I’m not mistaken. On the other hand, I don’t really know how to create the Spline inside the S-Function.
Coming back to your first question, the cost function I used so far was of type linear least square.
I hope that makes my problem more understandable