How to use casadi.interpolant in the model definition phase

I encountered a new problem during the experiment:

  1. I need to call casasi’s interpolant function when defining AcadosModel models. However, if casasi’s function is used for definition, model.p has no value, and an error will be reported; If i directly use the list to define model. p, an error will also be reported.

  2. I want to define such a dictionary shaped model. P. How do I need to set it?

    REF =  {
            "x": [1,2,3,4],
            "y": [1,2,3,4],
            "nl": [1,2,3,4],
            "nr": [1,2,3,4],
            "heading": [1,2,3,4],
            "kappa": [1,2,3,4]}

    weight_q = [1e-1, 1e-20, 1e-8, 1e-4, 5e-3]
    weight_qe = [2e0, 1e-20, 1e-8, 5e-4, 2e-3]
    weight_r = [1e-3, 5e-3]
    model.p = [REF,weight_q,weight_qe,weight_r] #### is here

    # dynamics
    kappa_ref = REF["kappa"]
    s_ref = REF["s"]
    nl = REF["nl"]
    nr = REF["nr"]
    kappa_ref_interp = interpolant("kappa_ref_interp", "bspline", [s_ref], kappa_ref) #### and here

I look forward to hearing from you! thanks!!!

you are defining your parameters in a wrong way. You first have to define every parameter as a symbol, e.g. s1 = cs.SX.sym('s1'). You assert those symbols to your model.p attribute. Afterwards you define the initial values of those parameters as a list containing floats/integers and assert them to ocp.parameter_values. Does this help you? Otherwise I recommend you to explore the examples in the acados example folder :).

yes, i know it ,but if i define a symbol, it will report wrong, because it will not be used to interpolant.
can you tell me an example?
thank you!