@@ -191,7 +191,11 @@ def plot(self, block=False, plotargs=None, textargs=None):
191191 ax .set_xlim (0 , max (self .t ))
192192
193193 if self .istime :
194- ax .set_ylabel ('$s(t)$' , ** textopts )
194+ if self .name in ('traj' , 'mtraj' , 'mstraj' ):
195+ symbol = 'q'
196+ else :
197+ symbol = 's'
198+ ax .set_ylabel (f"${ symbol } (t)$" , ** textopts )
195199 else :
196200 ax .set_ylabel ('$s(k)$' , ** textopts )
197201
@@ -202,7 +206,7 @@ def plot(self, block=False, plotargs=None, textargs=None):
202206 ax .set_xlim (0 , max (self .t ))
203207
204208 if self .istime :
205- ax .set_ylabel ('$ds/dt$' , ** textopts )
209+ ax .set_ylabel (f"$\dot{{ { symbol } }}(t)$" , ** textopts )
206210 else :
207211 ax .set_ylabel ('$ds/dk$' , ** textopts )
208212
@@ -213,7 +217,7 @@ def plot(self, block=False, plotargs=None, textargs=None):
213217 ax .set_xlim (0 , max (self .t ))
214218
215219 if self .istime :
216- ax .set_ylabel ('$ds^2/dt^2$' , ** textopts )
220+ ax .set_ylabel (f"$\ddot{{ { symbol } }}(t)$" , ** textopts )
217221 ax .set_xlabel ('t (seconds)' )
218222 else :
219223 ax .set_ylabel ('$d^2s/dk^2$' , ** textopts )
@@ -459,16 +463,16 @@ def lspbfunc(t):
459463 return func
460464# -------------------------------------------------------------------------- #
461465
462- def jtraj (q0 , qf , tv , qd0 = None , qd1 = None ):
466+ def jtraj (q0 , qf , t , qd0 = None , qd1 = None ):
463467 """
464468 Compute a joint-space trajectory
465469
466470 :param q0: initial joint coordinate
467471 :type q0: array_like(n)
468472 :param qf: final joint coordinate
469473 :type qf: array_like(n)
470- :param tv : time vector or number of steps
471- :type tv : array_like or int
474+ :param t : time vector or number of steps
475+ :type t : array_like or int
472476 :param qd0: initial velocity, defaults to zero
473477 :type qd0: array_like(n), optional
474478 :param qd1: final velocity, defaults to zero
@@ -496,12 +500,12 @@ def jtraj(q0, qf, tv, qd0=None, qd1=None):
496500 :seealso: :func:`ctraj`, :func:`qplot`, :func:`~SerialLink.jtraj`
497501 """
498502 # print(f" --- jtraj: {q0} --> {q1} in {tv}")
499- if isinstance (tv , int ):
503+ if isinstance (t , int ):
500504 tscal = 1.0
501- t = np .linspace (0 , 1 , tv ) # normalized time from 0 -> 1
505+ ts = np .linspace (0 , 1 , t ) # normalized time from 0 -> 1
502506 else :
503- tscal = max (tv )
504- t = tv .flatten () / tscal
507+ tscal = max (t )
508+ ts = t .flatten () / tscal
505509
506510 q0 = getvector (q0 )
507511 qf = getvector (qf )
@@ -531,7 +535,7 @@ def jtraj(q0, qf, tv, qd0=None, qd1=None):
531535
532536 # n = len(q0)
533537
534- tt = np .array ([t ** 5 , t ** 4 , t ** 3 , t ** 2 , t , np .ones (t .shape )]).T
538+ tt = np .array ([ts ** 5 , ts ** 4 , ts ** 3 , ts ** 2 , ts , np .ones (ts .shape )]).T
535539 coeffs = np .array ([A , B , C , np .zeros (A .shape ), E , F ]) # 6xN
536540
537541 qt = tt @ coeffs
@@ -547,7 +551,7 @@ def jtraj(q0, qf, tv, qd0=None, qd1=None):
547551 20 * A , 12 * B , 6 * C , np .zeros (A .shape )])
548552 qddt = tt @ coeffs / tscal ** 2
549553
550- return Trajectory ('jtraj' , t , qt , qdt , qddt )
554+ return Trajectory ('jtraj' , t , qt , qdt , qddt , istime = True )
551555
552556
553557
0 commit comments