Home > . > ctraj.m

ctraj

PURPOSE ^

CTRAJ Compute a Cartesian trajectory between two points

SYNOPSIS ^

function tt = ctraj(t0, t1, n)

DESCRIPTION ^

CTRAJ Compute a Cartesian trajectory between two points

     TC = CTRAJ(T0, T1, N)
    TC = CTRAJ(T0, T1, R)

 Returns a Cartesian trajectory TC from point T0 to T1.  The number
 of points is N or the length of the given path distance vector R.

 In the first case the points are equally spaced between T0 and T1.
 In the second case R gives the distance along the path, and the 
 elements of R must be in the range [0 1].

 Each trajectory is a 4x4xn matrix, with the last subscript being the
 point index.

 SEE ALSO: TRINTERP, QINTERP, TRANSL.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %CTRAJ Compute a Cartesian trajectory between two points
0002 %
0003 %     TC = CTRAJ(T0, T1, N)
0004 %    TC = CTRAJ(T0, T1, R)
0005 %
0006 % Returns a Cartesian trajectory TC from point T0 to T1.  The number
0007 % of points is N or the length of the given path distance vector R.
0008 %
0009 % In the first case the points are equally spaced between T0 and T1.
0010 % In the second case R gives the distance along the path, and the
0011 % elements of R must be in the range [0 1].
0012 %
0013 % Each trajectory is a 4x4xn matrix, with the last subscript being the
0014 % point index.
0015 %
0016 % SEE ALSO: TRINTERP, QINTERP, TRANSL.
0017 %
0018 
0019 % Copyright (C) 1993-2008, by Peter I. Corke
0020 %
0021 % This file is part of The Robotics Toolbox for Matlab (RTB).
0022 %
0023 % RTB is free software: you can redistribute it and/or modify
0024 % it under the terms of the GNU Lesser General Public License as published by
0025 % the Free Software Foundation, either version 3 of the License, or
0026 % (at your option) any later version.
0027 %
0028 % RTB is distributed in the hope that it will be useful,
0029 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0030 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0031 % GNU Lesser General Public License for more details.
0032 %
0033 % You should have received a copy of the GNU Leser General Public License
0034 % along with RTB.  If not, see <http://www.gnu.org/licenses/>.
0035 
0036 function tt = ctraj(t0, t1, n)
0037     if length(n) == 1,
0038         i = 1:n;
0039         r = (i-1)/(n-1);
0040     else
0041         r = n(:)';
0042         n = length(r);
0043     end
0044 
0045     if any(r> 1) | any(r<0),
0046         error('path position values (R) must 0<=R<=1)')
0047     end
0048     tt = zeros(4,4,0);
0049 
0050     for R=r,
0051         tt = cat(3, tt, trinterp(t0, t1, R));
0052     end
0053 
0054

Generated on Sun 15-Feb-2009 18:09:29 by m2html © 2003