Skip to content
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

Align WBT and BlockFactory #168

Merged

Conversation

diegoferigo
Copy link
Member

This PR contains the modification required to work with the current master branch of BlockFactory.

@diegoferigo diegoferigo self-assigned this Jan 30, 2019
@diegoferigo diegoferigo force-pushed the feature/AlignWithBlockFactory branch 4 times, most recently from c79004b to 1585307 Compare January 31, 2019 13:38
@diegoferigo diegoferigo changed the title [WIP] Align WBT and BlockFactory Align WBT and BlockFactory Jan 31, 2019
LIST_PREFIX WBT
SOURCES src/QpOases.cpp
HEADERS include/WBToolbox/Block/QpOases.h)
if(${qpOASES_FOUND})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change, qpOASES blocks are compiled even if WBT_USES_QPOASES is not enabled. I am afraid this may be confusing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want this to be the behaviour (not a big fan of it to be honest), problably it would make sense to just remove those variables then.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmh I didn't realized I used the _FOUND here, my mistake. If you see in the bottom of this file, the WBT_USES_ variables are used again. Thanks!

# Other
list(APPEND WBT_BLOCKS "RealTimeSynchronizer")

if(${ICUB_FOUND})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blockInfo->getOutputPortMatrixSize(OutputIndex::Jacobian).first,
blockInfo->getOutputPortMatrixSize(OutputIndex::Jacobian).second);
blockInfo->getOutputPortMatrixSize(OutputIndex::Jacobian).rows,
blockInfo->getOutputPortMatrixSize(OutputIndex::Jacobian).cols);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was really necessary! I regretted using pairs and tuples in this case.

Copy link
Member

@traversaro traversaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments on the WBT_USES_** options

@diegoferigo
Copy link
Member Author

Done.

For what concern the temporary CI fix, I would keep it in this PR, regenerate the docker images after merging, and then revert the commit.

@@ -5837,14 +5837,14 @@ Library {
}
Block {
BlockType S-Function
Name "Yarp Read"
Name "YarpRead"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if WB-Toolbox will always ship the manually written .slx/.mdl, I think this space removal is good for eventual consistency with blockfactory libraries generated by robotology/blockfactory#10 .

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure less error prone, it was a trivial change, just some sed magic. Lucky us that we use mdl and not slx.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OT: To be honest I am still confused on the role of mdl and slx in WBToolbox. The .slx model include .mdl one, but has support for the images? We could use the mdl also in the example of BlockFactory?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should try again substituting the slx with the mdl also in the installed tree.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I just tried. The models work fine, but the library does not show up in the Simulink Library.

screenshot

Copy link
Member

@traversaro traversaro Jan 31, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So let me recap:

  • The file that you mantain is the <something>.mdl
  • Then you save it to .slx, using the export_library.m script, and that is the file that you are installing so that it can be found by Simulink

is this correct?

I do not think the .slx file is a big problem for WB-Toolbox, but just as thought experiment: why we do not run the export_library.m script as part of the build project to create the .slx in the build directory, and then we install as any build artefact?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to finish this discussion, installing the mdl is not optimal and can create problems after an update. If the user resaves the library in slx, and afterwards the mdl is updated after an upstream change, the slx does not get updated automatically and there is no warning to the user. This means that the user thinks to have the latest update from the repository but instead he / she is running an old version. This marks installing mdl not an option.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some while ago I stored some information on the export process here (a bit unusual but there was no website at the moment):

# The logic about library development is the following:
#
# * Developers should edit the library (e.g. changing block's masks) stored in the
# matlab/library/WBToolboxLibrary_repository.mdl file.
# * Developers should export the changes using the export_library custom target.
# * Users will use the files installed from the exported/ folder.

why we do not run the export_library.m script as part of the build project to create the .slx in the build directory, and then we install as any build artefact?

Usually the mdl is exported with the matlab version of the maintainer of the library (:hand:). If users have an old version of Matlab they cannot convert a model / library created with a newer version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. I finally got it, I think. So if we did not wanted to commit a .slx we could first save the mantainer's .mdl to a mdl compatible with 2014b:

save_system(libraryName, 'WBToolboxLibrary', 'ExportToVersion', 'R2014B_MDL');

and then convert it to R2014B_SLX just during the build on the user's machine, before its install, to support correctly the EnableLBRepository option.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly

Copy link
Member

@traversaro traversaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .slx/.mdl discussion should not block the merge.

@diegoferigo diegoferigo merged commit ccb1447 into robotology:devel Jan 31, 2019
@diegoferigo diegoferigo deleted the feature/AlignWithBlockFactory branch January 31, 2019 15:30
@diegoferigo
Copy link
Member Author

Merged, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants