-
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
Suggestion for configuring Size And Ports into Initialize phase #51
Comments
TL;DR
Before running a simulation, Simulink performs a series of predefined steps to prepare the DAG that describes the execution order of the blocks. You can read more at this link. To answer your question, you need to know that the
These two steps are completely independent. This means that, as documented, all the block resources configured / allocated in
If Simulink cannot figure out the signal size, it fails with an error and does not continue. This is not so unlikely if you're writing your own blocks. In fact, if you overuse dynamic size, it might happen that Simulink is not able to finalize the size propagation. This is more or less what happens under the hood in the first phase of the simulation, or also when you press Ctrl+D. Despite it is not forbidden to call in the |
Hi @diegoferigo, thanks for your time. This would not be a problem for us, but, if I understood correctly from @DavideAntonucci, the
Now, when a block is dropped, we have no idea about the ports size, because they depend on the URDF which, in out context, could not be available until the play button is pressed. Have you experienced this problem as well? |
I guess @diegoferigo can answer with more details, but in the meanwhile I think I can answer that in the WB-Toolbox case the URDF and the list of controller joints is assumed to be known at that stage, as you can see in the case of a block such as the one that computes the Jacobian: |
It could be, I think it is used to update the mask I/O appearance as soon as you drop the block in a model.
As @traversaro wrote, blocks belonging to our WBToolbox have access to the URDF already from the In your case, if the URDF is only available when you press the play button, means that you have access to its data starting from the Right now I don't see any solution that does not involve moving the URDF parsing to the |
The following Simulink functions to define "accepted" values for dynamically sized ports seems to be interesting:
depending on when they are called, implementing in some way support for calling them in BlockFactory could solve this problem. Anyone has experience with them? An interesting project (similar to BlockFactory) that implements them is EasyLink, see: Also this piece of code seems to be related, and I guess @alaurenzi should be familiar with it : ) : |
@traversaro I remember I played a bit with those methods in order to solve propagation problems we faced in the past, without any luck unfortunately. I recall that I couldn't make them work as expected, not sure if it was my fault of using them in the wrong way.
This is extremely interesting. We should have a look if they support also variable step solvers and other cases we did not yet implement. |
I am not sure, but I think the propagation problems that you had are not exactly the same as just declaring some port as dynamic and specifying their values after the initialization, as discussed in this issue. |
This discussion can be related: robotology/wb-toolbox#97 . |
Hi all, About this issue, we found a possible solution that consist to Configure Size and port in this way: Since we need to have the ROS Master and XBotCore Node alive to get, for instance, the joint number, during the configure size and port phase we check:
Then if the first step that it's checked by the Initialize phase too, is not satisfied, the Initialize method will print the error. This allows us to develop the libraries without having errors, as soon as the play button is pressed, all checks will be performed. |
Hi all,
My colleagues (@liesrock @alaurenzi) and I are working with the blockfactory to use our framework in Matlab/Simulink.
Is there a possibility to declare a size port during the initialize phase?
Since I use the configureSizeAndPorts method to declare my inputs and outputs with a dynamic size port and I know the size after the initialize phase, I was wondering if there is a chance to do it in this phase.
Davide.
The text was updated successfully, but these errors were encountered: