-
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
Automatically generate required Simulink library files #10
Comments
Reply by @diegoferigo in #5 (comment) : Having a templated slx imho does not simplify that much the creation / maintenance of a Simulink Library, it is usually a trivial step from the GUI. I am pretty sure that Matlab (even the cli version) has some functions to automatize it without dealing with the file formats. The main problem are the masks, the have to be developed from the GUI. I'm afraid that operating only on the |
Reply by @traversaro in #5 (comment) :
It is trivial, if you have MATLAB/Simulink. It would be nice to be able to setup a blockfactory library without having MATLAB/Simulink on your PC (my current situation, for example : ) ).
Why this should be the case? Everything that you input through the GUI should be contained in the <Block BlockType="S-Function" Name="Signal Math" SID="1">
<P Name="Ports">[2, 1]</P>
<P Name="Position">[335, 69, 470, 116]</P>
<P Name="ZOrder">1</P>
<P Name="FunctionName">BlockFactory</P>
<P Name="Parameters">'SignalMath','ExampleToolbox',operation</P>
<P Name="SFunctionDeploymentMode">off</P>
<P Name="EnableBusSupport">off</P>
<P Name="SFcnIsStateOwnerBlock">off</P>
<Mask>
<Display RunInitForIconRedraw="off">disp('Signal Math')
port_label('input',1,'Input 1')
port_label('input',2,'Input 2')
port_label('output',1,'Output')</Display>
<MaskParameter Name="operation" Type="popup" Evaluate="off">
<Prompt>Operation</Prompt>
<Value>Addition</Value>
<TypeOptions>
<Option>Addition</Option>
<Option>Subtraction</Option>
<Option>Multiplication</Option>
</TypeOptions>
</MaskParameter>
</Mask>
</Block> Indeed automatically generating this may not be trivial, but I do not think it is impossible. |
Reply by @diegoferigo in #5 (comment) :
Just to be clear, I never intended that this is impossible ^^ It is just complicating your own life. And, btw, if you don't plan to use Simulink (since you don't have it), why do you want to create a Simulink Library? If the aim is using / testing blockfactory, for simple models you could:
Without having Simulink I don't see any benefit of passing through the |
I really like how "re-implement Simulink" is just a minor bullet point. :D Jokes apart, my scenario is the following: This situation is similar to what we were experiencing with Matlab bindings, but fortunately now that we build the same exact bindings also against the mex interface of Octave, we do not have the same problem anymore. |
To clarify: this could be entirely optional from the user point of view, in a way that if a user as a complex system of manually coded |
For canonical examples (see AutogenerationExample.cpp or torqueBalancingYoga.cpp, and yes, in the Yoga controller we do not use any super fancy Simulink feature) effectively Simulink does not do this massive amount of work. Ok, they provide a lot of blocks ootb :) Of course it is a huge framework, but this is because its use case tends to infinity.
Your point is clear and I understand it. However, considering possible contributions to any project that has Simulink support, I would be really skeptical of accepting an arbitrarily complex PR with a new block if the contributor never tested it directly in Simulink (should I do the tests personally? At the moment there is no way to use CI for this). I am not against implementing it if we think that it can speed up our workflow. |
That's true. Probably I am thinking about more simple cases. Let's think for example about the orientation filters that @prashanthr05 is implementing in iDynTree: if a user implements an additional type of estimation, and assuming the rest of signal processing and plumbing has been already tested in Simulink, I would not block the PR on a test on Simulink. |
In those case I agree. In the end it would translate to adding a single <MaskParameter Name="filterType" Type="popup" Evaluate="off">
<Prompt>Filter Type</Prompt>
<Value>DefaultFilter</Value>
<TypeOptions>
<Option>DefaultFilter</Option>
<Option>FilterFoo1</Option>
<Option>FilterFoo2</Option>
</TypeOptions>
</MaskParameter> As a last comment, we should consider that the Simulink Library must be in |
And that is exactly why I think it would be good if downstream users of By the way, this example seem to highlight that it would be nice to have a enumeration kind of parameter to explicitly specify the allowed options for the |
Related discussion (a bit in an unusual place): robotology/wb-toolbox#168 (comment) . |
I finally got a lot of things from robotology/wb-toolbox#168 (comment) , especially that it could be feasible to just automatically generate a |
@diegoferigo if we could export once the |
As This is the strategy that we used in sdf-modelica, using the single header libraries |
Cool, I didn't know this C++ version of Mustache, in the past I used the python version with nice results. As probably I just said somewhere else, in my opinion the most difficult part to templatize is the block mask (check the Configuration block as a complex example). For simple blocks instead it should be trivial. Honestly my main concern is Simulink compatibility, there are so many options added every release that are hard to track. Just think that Simulink models are never compatible with older releases. |
Yes, my idea would be to offer automatic generation of the Simulink file as options. If someone needs more fancy stuff like strange masks of nested "subgroups" in the library like in WB-Toolbox, he/she would need to code them directly bypassing the automatic generation.
My idea was to use an old version |
Hopefully, yes. |
Original comment by @traversaro in #5 (comment) :
Interestingly, part of this solution could be eventually re-used to automatize the existing manual process of writing the
.slx
file of the block library (i.e. the one described in https://robotology.github.io/blockfactory/mkdocs/create_new_library/#create-an-new-simulink-library).As you can check by manually inspecting an
.slx
file, and by reading in https://stackoverflow.com/questions/23408186/information-about-simulink-mdl-and-slx-formats, the.slx
is just a.zip
file that contains a bunch of.xml
(and some other format) files. A complete parser for reading/writing.slx
does not seem to be available or feasible, but perhaps it could make sense to have a "template".slx
that can be be configured based on the library blocks' and ports.The text was updated successfully, but these errors were encountered: