Skip to content

Commit 581d9d2

Browse files
committed
throw trinterp exceptions as SE3 exceptions
1 parent f1f8fc2 commit 581d9d2

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

SE3.m

+21-2
Original file line numberDiff line numberDiff line change
@@ -435,10 +435,29 @@ R zeros(3,3)
435435
% interp(SE3, SE3, s) interpolate between given values
436436
obj2 = varargin{1};
437437
varargin = varargin(2:end);
438-
Ti = SE3( trinterp(obj1.T, obj2.T, varargin{:}) );
438+
try
439+
Ti = SE3( trinterp(obj1.T, obj2.T, varargin{:}) );
440+
catch me
441+
switch me.identifier
442+
case 'RTB:trinterp:badarg'
443+
throw( MException('RTB:SE3:interp:badarg', 'value of S outside interval [0,1]') );
444+
otherwise
445+
rethrow(me);
446+
end
447+
end
439448
else
440449
% interp(SE3, s) interpolate between null and given value
441-
Ti = SE3( trinterp(obj1.T, varargin{:}) );
450+
try
451+
T = trinterp(obj1.T, varargin{:});
452+
catch me
453+
switch me.identifier
454+
case 'RTB:trinterp:badarg'
455+
throw( MException('RTB:SE3:interp:badarg', 'value of S outside interval [0,1]') );
456+
otherwise
457+
rethrow(me);
458+
end
459+
end
460+
T = SE3(T);
442461
end
443462
end
444463

trinterp.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
% integer value
6565
r = linspace(0, 1, r);
6666
elseif any(r<0 | r>1)
67-
error('RTB:trinterp', 'values of S outside interval [0,1]');
67+
error('RTB:trinterp:badarg', 'values of S outside interval [0,1]');
6868
end
6969

7070
q0 = UnitQuaternion(T0);
@@ -77,5 +77,5 @@
7777
end
7878

7979
else
80-
error('RTB:trinterp:badarg', 'must be 2 or 3 arguments');
80+
error('RTB:trinterp:wrongargs', 'must be 2 or 3 arguments');
8181
end

unit_test/RTBPoseTest.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
% we will assume that the primitives rotx,trotx, etc. all work
66

77

8-
function constructor(testCase)
8+
function constructor_test(testCase)
99
q = Quaternion([1 2 3 4]);
1010
verifyEqual(testCase, q.double(),[1 2 3 4],'absTol',1e-4);
1111

@@ -16,7 +16,7 @@ function staticconstructors(testCase)
1616
end
1717

1818

19-
function multiply(testCase)
19+
function multiply_test(testCase)
2020
% scalar x scalar
2121

2222
% vector x vector

0 commit comments

Comments
 (0)