How can I augment a toolbox to improve its capabilities?
2 views (last 30 days)
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?
Accepted Answer
Rik
on 6 Jan 2021
The answer by dpb is what you should do, but the answer to the question as posed is this:
Matlab is closed-source. Mathworks will probably not accept any changes to their code that they didn't write themselves. The cost is not just the edit itself, but also editing the documentation, added testing load to confirm no bugs are (re)introduced, and opportunity cost. The time spent on this function can't be spent elsewhere.
However, you can send an enhancement request which they may act on. It does happen, but they have to be convinced it is worth the cost.
More Answers (1)
dpb
on 6 Jan 2021
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
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.
See Also
Categories
Find more on Operators and Elementary Operations 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!