-
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
Fix Matlab Wrapper #953
Fix Matlab Wrapper #953
Conversation
248971868 Merge pull request #132 from borglab/fix/matlab-wrapper 157fad9e5 fix where generation of wrapper files takes place f2ad4e475 update tests and fixtures 65e230b0d fixes to get the matlab wrapper working git-subtree-dir: wrap git-subtree-split: 24897186873c92a32707ca8718f7e7b7dbffc589
@varunagrawal Did you run MATLAB unit tests and examples? If so we can merge, need to cut the release very soon. |
I ran the unit tests but not the examples. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me!
@mattking-smith this PR seems ready to go, but is just awaiting your confirmation it does work :-) |
Thanks for the fixes Varun. I wonder if we can use |
Although I was able to successfully run the test cases under /home/username/toolbox/gtsam_tests and generate the following output:
I am having some errors running some of the GTSAM examples (/home/username/toolbox/gtsam_examples). Specifically, I am seeing the following error:
This error persists for all examples containing the noiseModel class. Was the noiseModel class changed and not updated on the MATLAB side? |
@mattking-smith Thanks! Yes, that could be the case. Since now the tests work, I will merge this PR, But could I ask you to create an issue to fix the Matlab examples.? |
I think that’s a great idea, but we would need some volunteer to implement it :-) I do not want Varun to do this before RSS. Ideally it’s somebody who is invested as they are using the Matlab toolbox on a daily basis. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to fix the wrapper and linking of GTSAM + MATLAB.
However, 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:
>> stereo_model = noiseModel.Isotropic.Sigma(3,1);
Error using gtsam.noiseModel.Isotropic.Sigma (line 76)
Arguments do not match any overload of function
Isotropic.Sigma
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:
function varargout = Sigma(varargin)
% SIGMA usage: Sigma(size_t dim, double sigma, bool smart) : returns gtsam.noiseModel.Isotropic
% Doxygen can be found at https://gtsam.org/doxygen/
if length(varargin) == 3 && isa(varargin{1},'numeric') && isa(varargin{2},'double') && isa(varargin{3},'logical')
varargout{1} = gtsam_wrapper(1092, varargin{:});
return
end
error('Arguments do not match any overload of function Isotropic.Sigma');
end
Hence executing
>> stereo_model = noiseModel.Isotropic.Sigma(3,1,true);
is handled without error and GTSAM can properly optimize the StereoVOExample.m file:
Optimizing
Elapsed time is 0.014737 seconds.
So yes the wrap fixes the linking, however it appear that some wrapper definitions have changed and the baseline example codes in MATLAB need to updated to reflect this.
I am just seeing this. I can move this issue to the appropriate form |
@johnwlambert yes I have actually considered that from a year ago(!!) but Octave has a slightly different wrapping process and the time investment vs reward gained was not sufficient for me. My job is research after all and we use the python wrapper more. 🙂 |
I already tried octave for CI 2 years ago, it's not worth it... Maybe octave has evolved, but someone (not me or varun) should investigate. |
@mattking-smith I forgot to mention this due to the time crunch: the matlab wrapper does not yet support default arguments. This is why you're seeing the issue. The .i files allow for specifying default arguments to various parameters and gtwrap can take those into account. This happens for the python wrapper but not yet for the matlab wrapper. |
But why would that create a failure? The examples were written before default arguments existed. |
So am I still trying to open an issue in the matlab issue section?
Should I be pointing out this MATLAB bug in a new issue? |
I think it would be good if you guys talked for five minutes over blue jeans. If default arguments in the wrapper caused the matlab wrapper to fail, then that is an urgent bug but that needs to be fixed, so yes please create an issue John is correct to point out that the lack of CI makes this possible without us knowing it. From a process point of view, the people that change the wrapper, should then count on compiling the wrapper on their own machine at least. No blame here, just what we should do moving forward. |
@mattking-smith for now just add the missing arguments and it should work. @dellaert default arguments to Python were added earlier in the spring, and not to Matlab (this is my bad). The fix is simple though to just add the argument into the scripts. I can figure out matlab default arguments later this week after I finish the higher priority items. |
I think it would be good if you guys talked for five minutes over blue jeans: maybe Matt could fix this in wrap and get some insight into how the wrapper is generated... |
gtwrap
updates and other fixes to get the GTSAM matlab wrapper working.@mattking-smith can you please pull this branch to your system and check? Everything should work at this point.
If you can confirm that everything works, you can approve this PR and we can merge it.