@@ -670,14 +670,18 @@ def qplot(x, y=None, arm=False, block=False, labels=None):
670
670
671
671
# -------------------------------------------------------------------------- #
672
672
673
- def ctraj (T0 , T1 , s ):
673
+ def ctraj (T0 , T1 , t = None , s = None ):
674
674
"""
675
675
Cartesian trajectory between two poses
676
676
677
677
:param T0: initial pose
678
678
:type T0: SE3
679
679
:param T1: final pose
680
680
:type T1: SE3
681
+ :param t: number of samples or time vector
682
+ :type t: int or ndarray(n)
683
+ :param s: array of distance along the path, in the interval [0, 1]
684
+ :type s: ndarray(s)
681
685
:return T0: smooth path from ``T0`` to ``T1``
682
686
:rtype: SE3
683
687
@@ -686,7 +690,10 @@ def ctraj(T0, T1, s):
686
690
the path. The Cartesian trajectory is an SE3 instance containing ``n``
687
691
values.
688
692
689
- ``ctraj(T0, T1, s)`` as above but the elements of ``s`` specify the
693
+ ``ctraj(T0, T1, t)`` as above but the trajectory is sampled at
694
+ the points in the array ``t``.
695
+
696
+ ``ctraj(T0, T1, s=s)`` as above but the elements of ``s`` specify the
690
697
fractional distance along the path, and these values are in the
691
698
range [0 1]. The i'th point corresponds to a distance ``s[i]`` along
692
699
the path.
@@ -713,8 +720,11 @@ def ctraj(T0, T1, s):
713
720
:func:`~spatialmath.unitquaternion.interp`
714
721
"""
715
722
716
- if isinstance (s , int ):
717
- s = lspb (0 , 1 , s ).s
723
+ if isinstance (t , int ):
724
+ s = lspb (0 , 1 , t ).s
725
+ elif isvector (t ):
726
+ t = getvector (t )
727
+ s = lspb (0 , 1 , t / np .max (t )).s
718
728
elif isvector (s ):
719
729
s = getvector (s )
720
730
else :
0 commit comments