Hi Jonathan,
CasADi implements its own splines
If I use CasADi splines I have the same problem as with ppval(…). The position where I evaluate the spline is an optimization variable (SX.sym). For example using the following lines of code
x = -1 : 0.1 : 1;
y = randn(size(x));
% state variable of dynamics equation
x_eval = SX.sym('x_eval');
pp_casadi = casadi.interpolant('pp', 'bspline', {x}, y);
% meaningless cost function just for demonstration
expr_ext_cost = pp_casadi(x_eval)^2;
results in the following error during code generation:
Error using casadi.Function/call (line 935)
.../casadi/core/function_internal.cpp:1821: 'eval_sx' not defined for BSplineInterpolant
Error in casadi.Function/paren (line 1763)
res = self.call(varargin);
Error in casadi.Function/subsref (line 1744)
[varargout{1:nargout}]= paren(self, s.subs{:});
Error in acadosNLPFormulation (line 46)
expr_ext_cost = pp_casadi(x_eval)^2;
BR
Martin