Menu

Trajectory tracking

2020-03-23
2020-03-26
  • Leticia Mayumi Kinjo

    Hi everyone,

    I am new using the GRAMPC framework, and I would like to know if it is possible to solve a trajectory tracking problem in GRAMPC and how can I put a polynomial reference trajectory in the algorithm ?

    Also, I would like to know if anyone has the mathematical model used in the vehicle example.

    Thanks.
    Best regards,
    Leticia.

     
  • Andreas Völz

    Andreas Völz - 2020-03-23

    Hello Leticia,

    second question: the reference for the vehicle model is given in our journal paper https://link.springer.com/article/10.1007%2Fs11081-018-9417-2 as
    Werling M, Reinisch P, Gresser K (2012) Kombinierte Brems-Ausweich-Assistenz mittels nichtlinearer modellprädiktiver Trajektorienplanung für den aktiven Fußgängerschutz. Tagungsband des 8. Work-shop Fahrerassistenzsysteme, pp 68–77
    These proceedings are available online under https://www.uni-das.de/images/pdf/fas-workshop/2012/FAS2012_Tagungsband.pdf and the model is stated in equations (1)-(5).

    first question: GRAMPC can be used to solve trajectory tracking problems. To this end, the parameters of the reference trajectory (discrete sampling steps, coefficients of the polynomial, etc.) as well as the current time step t0 have to be passed to the problem functions via userparam. If you use the C interface, you can define userparam as a struct. If you use the MATLAB interface, userparam is interpreted as array of float/double. Maybe the example probfct_REACTOR_CSTR_MHE.c helps, where something similar is implemented in the cost function. Your code may look something like

    void lfct(typeRNum* out, typeRNum t, ctypeRNum* x, ctypeRNum* u, ctypeRNum* p, ctypeRNum* xdes, ctypeRNum* udes, typeUSERPARAM* userparam)
    {
        typeRNum* trajparam = (typeRNum*)userparam;
        typeRNum t0 = trajparam[0];
        typeRNum* coeff = trajparam + 1;
    
        typeRNum xref = coeff[0] * (t0 + t) * (t0 + t) + coeff[1] * (t0 + t) + coeff[2];
    
        out[0] = (x[0] - xref) * (x[0] - xref);
    }
    

    Please ask if you need further help.

    Regards,
    Andreas Völz

     
    👍
    1
  • Leticia Mayumi Kinjo

    Hi Andreas,

    Thank you so much for your answer !!
    I found the model of the vehicle and the tracking worked ! (:
    I still have a question tough, the "t0" term is the time at the current sample step, but I don't understand what is the role of "t". Could you explain me please ?

    Have a nice week.
    Best regards,
    Leticia

     

    Last edit: Leticia Mayumi Kinjo 2020-03-25
  • Andreas Völz

    Andreas Völz - 2020-03-25

    Hello Leticia,

    the role of t depends on the function. Typically, it is the prediction time of the MPC with the range [0, Thor]. That is the case in the cost function, which is why you have to use (t0 + t) if the desired trajectory depends on the "global" time. The exception is the system model ffct, where t is the global time. If one needs the prediction time in the system model, one has to use (t - t0). These details are also explained in the GRAMPC documentation in the section problem formulation.

    Refards,
    Andreas Völz

     
  • Leticia Mayumi Kinjo

    Hello Andreas,

    Thank you for your quick answer
    I have already read the manual of GRAMPC, but I haven't find a explanation regarding these different roles of t, just for t0.

    Thanks for this explanation and all your help !

    Best regards,
    Leticia

     
  • Andreas Völz

    Andreas Völz - 2020-03-25

    Hello Leticia,

    I have referred to the following paragraph in Section 3.1 in the GRAMPC manual

    The terminal cost V as well as the integral cost l and all constraints (g, g T , h, h T ) contain an explicit time dependency with regard to the internal time t. In addition, the system dynamics (3.1b) features an explicit time dependency. Note that in the context of MPC, the initial time t 0 and initial state x 0 correspond to the sampling instant t k that is incremented by the sampling time ∆t > 0 in each MPC step k.

    and the problem definition in equations (3.1), in particular the dependency on t0+t in (3.1b).

    Regards,
    Andreas

     
  • Leticia Mayumi Kinjo

    Hello Andreas,

    Thank you for your fast reply. All my questions were answered.
    I really appreciated your help !

    Kind regards,
    Leticia

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.