Skip to content

Commit 89cbbc7

Browse files
committed
Merge branch 'master' into future
2 parents bbd972f + 4cf4778 commit 89cbbc7

File tree

4 files changed

+32
-20
lines changed

4 files changed

+32
-20
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
os: [windows-latest, ubuntu-latest, macos-latest]
17-
python-version: [3.6, 3.7, 3.8, 3.9]
17+
python-version: [3.7, 3.8, 3.9]
1818
steps:
1919
- uses: actions/checkout@v2
2020
- name: Set up Python ${{ matrix.python-version }}

roboticstoolbox/robot/DHRobot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class DHRobot(Robot):
4949
:type name: str
5050
:param manufacturer: Manufacturer of the robot
5151
:type manufacturer: str
52-
:param base: Locaation of the base
52+
:param base: Location of the base
5353
:type base: SE3
5454
:param tool: Location of the tool
5555
:type tool: SE3

roboticstoolbox/robot/ERobot.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -842,13 +842,16 @@ def recurse(Tall, Tparent, q, link):
842842

843843
Tall[link.number] = T
844844

845-
if link.nchildren == 1:
845+
if link.nchildren == 0:
846+
# no children
847+
return
848+
elif link.nchildren == 1:
849+
# one child
850+
if link in self.ee_links:
851+
# this link is an end-effector, go no further
852+
return
846853
link = link.children[0]
847854
continue
848-
849-
elif link.nchildren == 0:
850-
return
851-
852855
else:
853856
# multiple children
854857
for child in link.children:

roboticstoolbox/tools/trajectory.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def qd(self):
101101
@property
102102
def qdd(self):
103103
"""
104-
Velocity trajectory
104+
Acceleration trajectory
105105
106106
:return: trajectory acceleration with one row per timestep, one column per axis
107107
:rtype: ndarray(n,m)
@@ -180,15 +180,23 @@ def plot(self, block=False, plotargs=None, textargs=None):
180180
ax.plot(self.t[k], self.s[k], color="green", **plotopts)
181181
k = np.where(k)[0][0]
182182
ax.plot(
183-
self.t[k - 1 : k + 1], self.s[k - 1 : k + 1], color="green", label="linear", **plotopts
183+
self.t[k - 1 : k + 1],
184+
self.s[k - 1 : k + 1],
185+
color="green",
186+
label="linear",
187+
**plotopts,
184188
)
185189

186190
# decel phase
187191
k = self.t > (tf - self.tblend)
188192
ax.plot(self.t[k], self.s[k], color="blue", **plotopts)
189193
k = np.where(k)[0][0]
190194
ax.plot(
191-
self.t[k - 1 : k + 1], self.s[k - 1 : k + 1], color="blue", label="deceleration", **plotopts
195+
self.t[k - 1 : k + 1],
196+
self.s[k - 1 : k + 1],
197+
color="blue",
198+
label="deceleration",
199+
**plotopts,
192200
)
193201

194202
ax.grid(True)
@@ -317,11 +325,11 @@ def quintic_func(q0, qf, T, qd0=0, qdf=0):
317325
# solve for the polynomial coefficients using least squares
318326
X = [
319327
[0, 0, 0, 0, 0, 1],
320-
[T ** 5, T ** 4, T ** 3, T ** 2, T, 1],
328+
[T**5, T**4, T**3, T**2, T, 1],
321329
[0, 0, 0, 0, 1, 0],
322-
[5 * T ** 4, 4 * T ** 3, 3 * T ** 2, 2 * T, 1, 0],
330+
[5 * T**4, 4 * T**3, 3 * T**2, 2 * T, 1, 0],
323331
[0, 0, 0, 2, 0, 0],
324-
[20 * T ** 3, 12 * T ** 2, 6 * T, 2, 0, 0],
332+
[20 * T**3, 12 * T**2, 6 * T, 2, 0, 0],
325333
]
326334
coeffs, resid, rank, s = np.linalg.lstsq(
327335
X, np.r_[q0, qf, qd0, qdf, 0, 0], rcond=None
@@ -340,10 +348,12 @@ def quintic_func(q0, qf, T, qd0=0, qdf=0):
340348

341349
# -------------------------------------------------------------------------- #
342350

351+
343352
def lspb(*args, **kwargs):
344353
warnings.warn("lsp is deprecated, use trapezoidal", FutureWarning)
345354
return trapezoidal(*args, **kwargs)
346355

356+
347357
def trapezoidal(q0, qf, t, V=None):
348358
"""
349359
Scalar trapezoidal trajectory
@@ -459,7 +469,7 @@ def trapezoidalfunc(t):
459469
pddk = 0
460470
elif tk <= tb:
461471
# initial blend
462-
pk = q0 + a / 2 * tk ** 2
472+
pk = q0 + a / 2 * tk**2
463473
pdk = a * tk
464474
pddk = a
465475
elif tk <= (tf - tb):
@@ -469,7 +479,7 @@ def trapezoidalfunc(t):
469479
pddk = 0
470480
elif tk <= tf:
471481
# final blend
472-
pk = qf - a / 2 * tf ** 2 + a * tf * tk - a / 2 * tk ** 2
482+
pk = qf - a / 2 * tf**2 + a * tf * tk - a / 2 * tk**2
473483
pdk = a * tf - a * tk
474484
pddk = -a
475485
else:
@@ -567,7 +577,7 @@ def jtraj(q0, qf, t, qd0=None, qd1=None):
567577

568578
# n = len(q0)
569579

570-
tt = np.array([ts ** 5, ts ** 4, ts ** 3, ts ** 2, ts, np.ones(ts.shape)]).T
580+
tt = np.array([ts**5, ts**4, ts**3, ts**2, ts, np.ones(ts.shape)]).T
571581
coeffs = np.array([A, B, C, np.zeros(A.shape), E, F]) # 6xN
572582

573583
qt = tt @ coeffs
@@ -580,7 +590,7 @@ def jtraj(q0, qf, t, qd0=None, qd1=None):
580590
coeffs = np.array(
581591
[np.zeros(A.shape), np.zeros(A.shape), 20 * A, 12 * B, 6 * C, np.zeros(A.shape)]
582592
)
583-
qddt = tt @ coeffs / tscal ** 2
593+
qddt = tt @ coeffs / tscal**2
584594

585595
return Trajectory("jtraj", tv, qt, qdt, qddt, istime=True)
586596

@@ -648,8 +658,6 @@ def mtraj(tfunc, q0, qf, t):
648658
return Trajectory("mtraj", x, y, yd, ydd, istime)
649659

650660

651-
652-
653661
# -------------------------------------------------------------------------- #
654662

655663

@@ -1012,7 +1020,8 @@ def mrange(start, stop, step):
10121020
# t.plot(block=True)
10131021

10141022
from roboticstoolbox import *
1023+
10151024
puma = models.DH.Puma560()
10161025

10171026
traj = jtraj(puma.qz, puma.qr, 100)
1018-
traj.plot(block=True)
1027+
traj.plot(block=True)

0 commit comments

Comments
 (0)