Menu

Setting LSQ reference in the C generated code

BardBakk
2014-01-23
2022-06-20
  • BardBakk

    BardBakk - 2014-01-23

    Hi all,

    if I want to set a reference that is to be tracked, I would normally include it as the last argument in the minimizeLSQ function like this

    ...
    Vector r(2);
    r(0) = 1;
    r(1) = 2;
    minimizeLSQ(Q,h,r);
    minimizeLSQEndTerm(QN,hN,rN);
    ...
    

    (Q - weight matrix; h - terms to be penalized; r - vector of reference values)
    However, when trying to export this to C code, an error message occurs saying that "Error: Only standard LSQ objective supported for code generation". Removing "r" and "rN", the code is exported perfectly, but my question then is: if I cannot set a reference in the C++ ACADO code, can I do it in the generated C code? If so, which variable is available for changing the reference value?

    Regards,
    bardbakk

     

    Last edit: BardBakk 2014-01-23
  • BardBakk

    BardBakk - 2014-01-23

    Nevermind, found that I had misunderstood the acadoVariables.y and acadoVariables.yN. These are the variables in which the reference is set.

     
  • Kaustav Mondal

    Kaustav Mondal - 2022-06-20

    I face the same problem.

    If I use

    minimizeLSQ(Q,h,r);
    minimizeLSQEndTerm(QN,hN,rN);
    

    I get "Error: Only standard LSQ objective supported for code generation".

    If I use

    minimizeLSQ(Q,h);
    minimizeLSQEndTerm(QN,hN);
    

    I don't get this error.

    Can I use acadoVariables.y and acadoVariables.yN in my C++ code without explicitly defining rand rN in my ACADO code ?

     

    Last edit: Kaustav Mondal 2022-06-20

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.