Comments (8)
This has to be discussed first. I feel that this might be app specific -- test and initialization.
I am more in favor to provide a few examples how this can be done, so that users have a good starting point.
from acado.
@ferreau, what is your opinion on this?
from acado.
I suggest the following:
-
Still, I think there needs to be an auto-generated basic initialisation for all variables (eg. x,u,p to zero, Q=Id, R=Id and so forth). Of course, a user needs to adapt this for each application, but it makes the code more fool-proof.
-
I have implemented a reset() function on my local copy (but I think it does not really make sense if I merge it back to the current version on the web). This hard-codes an initialization for all above-mentioned variables based on user-defined values. These values are passed to the MPCExport class before exporting the code.
from acado.
Default initialization in some cases (in fact a lot of them) leads to erratic behavior of a solver, e.g. to produce NaNs. Some users immediately think "solver made an error", instead to look and think about initialization. Thus, I am not in favor to generate test file in a new version of the codegen (which is on the way) any more, but to provide a set of well documented examples. Users should really think about how to initialize a solver. Furthermore, up to my knowledge, nobody inside our group is using auto-generated test files any more -- just to be sure: @rienq can give us an update on this if he thinks different.
However, if somebody wants to implement this functionality in a fool-proof way, I will not obstruct it. I just think that is not a path to go.
from acado.
I agree with Milan actually, although generating a test file without initializing any of the ACADO variables is not the answer. Because users would still not get a (compilation) error or anything, the solver would just give back NaNs and the "solver made an error" remark remains.
I feel like auto generated test files are still very useful, because (as a new user) you at least get a code structure where you can start from. If you then provide trivial initializations of all the variables, it would at least be clear they have to modify these to get the correct behaviour from the solver. This could also be stressed in the form of code comments for example.
from acado.
I agree with the second paragraph. We can export a template, i.e. well documented example, and force the user to modify it.
from acado.
I am typically exporting a test file once for a project and then keep editing myself. However, if test file generation would be more flexible I would even prefer to generate it afresh each time. Moreover, leaving the test file generation away does not really help as exporting a Matlab or Simulink interface is basically the same a generating a test file.
However, I very much like the idea of forcing the user to provide a meaningful initialization. One way could be generate a test file that does not compile if no initilization is provided when exporting the code. However, this needs to be documented very well as not compiling examples naturally raises questions.
In any case, I am happy to help with making the test file generation more fool-proof.
from acado.
I provided a dummy test file in the pre120branch. You can take a look at it, or wait until I merge it to the master, which should happen soon. Anyways, it is not so smart, I put some comments in there, but it should be possibly improved.
from acado.
Related Issues (20)
- S-Function through legacy Code Generation in Matlab
- When will there be a stable version?
- error: no rule to make target 'qpdunes/src/utils.o', needed by 'libacado_exported_rti.a'
- Timed solver interruption
- Autogenerated MPC Code segfaults in acado_feedbackStep( ) on large OCP definitions HOT 1
- Problem with IntermediateStates
- Slicing Matrices and Vectors in ACADO matrix class
- Installation in Mac OS HOT 2
- Inquires on ACADO with MATLAB and SIMULINK for the single-precision microcontroller
- MPC with on/off value HOT 1
- unable to interface with MATLAB HOT 2
- Setting LSQ reference in ACADO code, getting error
- what is the status of acado tookit?
- Trouble getting started HOT 1
- Constraint violation with Time-Scaled model
- how to improve the accuracy of the generated NMPC solver
- Unable to understand 'Shifting' and 'initialization' option in ACADO MPC simulink interface
- can you anybody explain what is online data ? HOT 1
- Code generation template path stays persistent between builds
- mpc.exportCode
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from acado.