-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Current status of tunable parameters #42
Comments
Also related to robotology/whole-body-controllers#26 |
Are we generating the C API to access the parameters, as described in https://github.com/Kvixen/Simulix#exporting-your-model-from-simulink ? Relevant matlab docs: https://it.mathworks.com/help/rtw/ug/data-interchange-using-the-c-api.html . |
I remember I tried them but I had no luck even with them. |
Note Cleaning up old issues and pull requests I opened over the past years that are now outdated or stale. If this is still relevant, feel free to reopen it or create a new one with updated details. Thanks! |
Despite the code generated with Simulink Coder supports tunable parameters, the ones coming from the block masks are not accessible. Refer to the
Operation
selected from the drop-down menu of theSignalMath
block of the example:blockfactory/example/matlab/AutogenerationExample_grt_rtw/AutogenerationExample.cpp
Lines 104 to 107 in a05e6d0
In line 105 it is hardcoded, and cannot be changed.
Instead, for what concern parameters that come from the workspace (and constants present in the Simulink Model are analogous), they are stored in a static struct:
blockfactory/example/matlab/AutogenerationExample_grt_rtw/AutogenerationExample.h
Lines 75 to 80 in a05e6d0
blockfactory/example/matlab/AutogenerationExample_grt_rtw/AutogenerationExample.cpp
Lines 390 to 400 in a05e6d0
Despite they can be changed during runtime (the symbol is static), it's basically impossible to know what is the index of the parameter you want to access. In this case there's only one, but if there were more, the cpp will contain a curly braces initialization for all of them. It would be great having a way to access these parameters e.g. by name (and I mean string, not name of the variable like
P_AutogenerationExample_T_.Constant_Value
in this case), but the approach used by the coder does not allow it.cc @traversaro
The text was updated successfully, but these errors were encountered: