@@ -191,7 +191,11 @@ def plot(self, block=False, plotargs=None, textargs=None):
191
191
ax .set_xlim (0 , max (self .t ))
192
192
193
193
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 )
195
199
else :
196
200
ax .set_ylabel ('$s(k)$' , ** textopts )
197
201
@@ -202,7 +206,7 @@ def plot(self, block=False, plotargs=None, textargs=None):
202
206
ax .set_xlim (0 , max (self .t ))
203
207
204
208
if self .istime :
205
- ax .set_ylabel ('$ds/dt$' , ** textopts )
209
+ ax .set_ylabel (f"$\dot{{ { symbol } }}(t)$" , ** textopts )
206
210
else :
207
211
ax .set_ylabel ('$ds/dk$' , ** textopts )
208
212
@@ -213,7 +217,7 @@ def plot(self, block=False, plotargs=None, textargs=None):
213
217
ax .set_xlim (0 , max (self .t ))
214
218
215
219
if self .istime :
216
- ax .set_ylabel ('$ds^2/dt^2$' , ** textopts )
220
+ ax .set_ylabel (f"$\ddot{{ { symbol } }}(t)$" , ** textopts )
217
221
ax .set_xlabel ('t (seconds)' )
218
222
else :
219
223
ax .set_ylabel ('$d^2s/dk^2$' , ** textopts )
@@ -459,16 +463,16 @@ def lspbfunc(t):
459
463
return func
460
464
# -------------------------------------------------------------------------- #
461
465
462
- def jtraj (q0 , qf , tv , qd0 = None , qd1 = None ):
466
+ def jtraj (q0 , qf , t , qd0 = None , qd1 = None ):
463
467
"""
464
468
Compute a joint-space trajectory
465
469
466
470
:param q0: initial joint coordinate
467
471
:type q0: array_like(n)
468
472
:param qf: final joint coordinate
469
473
: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
472
476
:param qd0: initial velocity, defaults to zero
473
477
:type qd0: array_like(n), optional
474
478
:param qd1: final velocity, defaults to zero
@@ -496,12 +500,12 @@ def jtraj(q0, qf, tv, qd0=None, qd1=None):
496
500
:seealso: :func:`ctraj`, :func:`qplot`, :func:`~SerialLink.jtraj`
497
501
"""
498
502
# print(f" --- jtraj: {q0} --> {q1} in {tv}")
499
- if isinstance (tv , int ):
503
+ if isinstance (t , int ):
500
504
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
502
506
else :
503
- tscal = max (tv )
504
- t = tv .flatten () / tscal
507
+ tscal = max (t )
508
+ ts = t .flatten () / tscal
505
509
506
510
q0 = getvector (q0 )
507
511
qf = getvector (qf )
@@ -531,7 +535,7 @@ def jtraj(q0, qf, tv, qd0=None, qd1=None):
531
535
532
536
# n = len(q0)
533
537
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
535
539
coeffs = np .array ([A , B , C , np .zeros (A .shape ), E , F ]) # 6xN
536
540
537
541
qt = tt @ coeffs
@@ -547,7 +551,7 @@ def jtraj(q0, qf, tv, qd0=None, qd1=None):
547
551
20 * A , 12 * B , 6 * C , np .zeros (A .shape )])
548
552
qddt = tt @ coeffs / tscal ** 2
549
553
550
- return Trajectory ('jtraj' , t , qt , qdt , qddt )
554
+ return Trajectory ('jtraj' , t , qt , qdt , qddt , istime = True )
551
555
552
556
553
557
0 commit comments