-
Notifications
You must be signed in to change notification settings - Fork 767
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
MATLAB Wrapper Does Not Support Default Arguments #954
Comments
This is the default argument issue: I think previously there were wt versions of the Sigma function: one with 2 arguments and one with 3. This was then replaced with one, with a default argument, but that (silently) broke the MATLAB examples. A quick fix, @mattking-smith , if you're up for it, is to push a quick PR with the "true" argument added in all examples that fail. Then we can take a bit more time fixing the wrapper code - and as I alluded to, it might be beneficial for you to be involved in that more permanent fix. |
Yeah I can do this to give a quick fix a go. |
As I am working on this I have been able to fix simple bugs, like adding For example in the LocalizationExample.m file, the command
The print function is defined in the NonlinearFactorGraph.m file as
The new additional argument here is the |
If it is limited to one or two classes, you can always add the two versions of the function back into the wrapper, ie One with the KeyFormatter and one without. Then the default argument will be selected in C++ |
@varunagrawal, I believe once the |
Yeah I'm already on that :) |
Description
It appears that the wrapper definitions generated when binding GTSAM to MATLAB need additional arguments then the default arguments provided for the MATLAB examples.
Steps to reproduce
Expected behavior
Successful completion of program
Observed behavior
I am seeing that errors when testing all the GTSAM examples in the gtsam_examples folder.
For example when looking at StereoVOExample.m when trying to execute
stereo_model = noiseModel.Isotropic.Sigma(3,1);
as written when compiled throws the error:
However looking at the wrapper definition under Isotropic.m states
%Sigma(size_t dim, double sigma, bool smart) : returns gtsam::noiseModel::Isotropic
where the Isotropic wrapper definition in MATLAB is:
Hence executing
>> stereo_model = noiseModel.Isotropic.Sigma(3,1,true);
is handled without error and GTSAM can properly optimize the StereoVOExample.m file:
Conclusion
It appear that some wrapper definitions have changed and the baseline example codes in MATLAB need to updated to reflect this, or the wrapper needs to be updated as to accommodate baseline default arguments.
Environment
MATLAB version: 2021a
Linux OS: Ubuntu 20.04
Standard GTSAM + MATLAB Toolbox build.
Originally posted by @mattking-smith in #953 (review)
The text was updated successfully, but these errors were encountered: