Menu

Generating multiple controllers in one project -> possibility to export code in a namespace?

Max B
2016-11-07
2016-11-07
  • Max B

    Max B - 2016-11-07

    Hi,
    I want to include multiple controllers generated by ACADO. Now the problem is since the data is passed to ACADO using global variables

    /* Global variables used by the solver. */
    ACADOvariables acadoVariables;
    ACADOworkspace acadoWorkspace;
    

    one has the problem of multiple definitions of these variables. Is there a possibility to namespace these variables such that one can have multiple instances of the variables, controller1::acadoVariables, controller2::acadoVariables...
    Obviously one does not want to change the autogenerated code by hand...

    Thank you for any advice!

     

    Last edit: Max B 2016-11-07
  • Mohit Mehndiratta

    Hey,

    In the cpp file, where you define your problem, their is an option to define custom module name. In order to have multiple controllers in the same code, just define different names for different controllers. For eg. If you have two controllers at the bottom of your each cpp file write this:
    cpp for nmpc1,
    mpc.set( CG_MODULE_NAME, "nmpc1" );
    cpp for nmpc2
    mpc.set( CG_MODULE_NAME, "nmpc2" );

    I hope this helps.

    Mohit

     

Log in to post a comment.

MongoDB Logo MongoDB