How can I augment a toolbox to improve its capabilities?
Show older comments
I am using the Robotics Systems Toolbox and its rotm2eul() function only takes in 3 possible rotation orders, XYZ, ZYX, and ZYZ. With permutations of these types there are 12 possibilities and matlab only works with a quarter of them. Adding support for the others is trivial thanks to the intelligent way the others were programmed. I only need to add 9 lines of code and remove a number of duplicated code statements in various code blocks.
2 Comments
Walter Roberson
on 6 Jan 2021
Can the other quarter be build by composing two calls to the function?
Andrew Roley
on 6 Jan 2021
Edited: Andrew Roley
on 6 Jan 2021
Accepted Answer
More Answers (1)
dpb
on 6 Jan 2021
0 votes
Don't have the TB in Q? so can't go look to see, but if it is an m-file, there are two ways -- you can just edit the copy in place although this is strongly discouraged.
Alternatively, shadow the function by creating a copy in a MATLABPATH location that aliases the supplied version -- it will be called preferentially before the original.
A third possiblity is to not use the builtin function directly but write a front end interface routine for it that your code calls and which, in turn, prepares the input into the form needed to call the original and then does so.
9 Comments
Andrew Roley
on 6 Jan 2021
Well, you could add the interface layer code solution to the FEX for others' use in that fashion, but TMW isn't going to just take user code and redistribute it even if it is a good idea. Best one can do there is to prod with enhancement request and a pointing out of the shortcoming in places like the Answers thread on wished-for improvements.
I've railed against functionality and/or klunkiness in certain user functions in responses to Q? posed here; some of which complaints go back 20 years or more since I first submitted enhancement requests for them. A few of those have actually now been implemented in the last year or two--whether the complaints made here had any effect on action now or not there's no way to know; but progress is progress, however achieved!
Andrew Roley
on 8 Jan 2021
dpb
on 8 Jan 2021
No, I wouldn't suggest posting the TMW m-file on FEX; I'm sure they would soon remove it even if you could get by the original posting... :)
That would be my third option above of "to not use the builtin function directly but write a front end interface routine for it that your code calls and which, in turn, prepares the input into the form needed to call the original and then does so."
That isn't as convenient nor as efficient but provides the functionality without revealing any of the internals publicly. With it, one has a differently-named toplevel user function instead of using the TMW function name.
Andrew Roley
on 16 Jan 2021
dpb
on 16 Jan 2021
I would think it's basically done with what you did -- just package that. But, I don't know the code not having the TB.
Andrew Roley
on 16 Jan 2021
Rik
on 17 Jan 2021
What we mean is something like the code below. The isequal function only compares two objects. This extends that
function tf=all_isqual(varargin)
%Compare all inputs to the first.
%This would be equivalent to isequal(varargin{:}) if isequal would allow multiple inputs.
tf=true;
try elem1=varargin{1};catch,end%reduce the number of times varargin{} is indexed
for n=2:nargin
tf= tf && isequal(elem1,varargin{n});
end
end
dpb
on 17 Jan 2021
I understand there's no real motivation on your end since you have a solution that works and that is the better implementation.
It would only be from your end the intellectual challenge you've outlined plus offering a tool to other users. And that may not be a very large pool, granted.
I can see you choosing either path and either is a perfectly valid choice.
Categories
Find more on Programming in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!