Skip to content

Commit 368b889

Browse files
committed
Added columns for joint limits
displayed if the robot has them
1 parent 4a47e84 commit 368b889

File tree

1 file changed

+37
-10
lines changed

1 file changed

+37
-10
lines changed

roboticstoolbox/robot/DHRobot.py

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,38 +119,64 @@ def qs(j, link):
119119

120120
def angle(theta):
121121
if sym.issymbol(theta):
122-
return "<<red>>" + str(L.alpha)
122+
return "<<red>>" + str(theta)
123123
else:
124-
str(L.alpha * deg) + "\u00b0"
124+
return str(theta * deg) + "\u00b0"
125125

126+
has_qlim = any([link._qlim is not None for link in self])
127+
if has_qlim:
128+
qlim_columns = [
129+
Column("q⁻", headalign="^"), Column("q⁺", headalign="^"),
130+
]
131+
qlim = self.qlim
132+
133+
else:
134+
qlim_columns = []
126135
if self.mdh:
136+
# MDH format
127137
table = ANSITable(
128138
Column("aⱼ₋₁", headalign="^"),
129139
Column("⍺ⱼ₋₁", headalign="^"),
130140
Column("θⱼ", headalign="^"),
131141
Column("dⱼ", headalign="^"),
142+
*qlim_columns,
132143
border="thick"
133144
)
134145
for j, L in enumerate(self):
146+
if has_qlim:
147+
if L.isprismatic():
148+
ql = [qlim[0, j], qlim[1, j]]
149+
else:
150+
ql = [angle(qlim[k, j]) for k in [0, 1]]
151+
else:
152+
ql = []
135153
if L.isprismatic():
136-
table.row(L.a, angle(L.alpha), angle(L.theta), qs(j, L))
154+
table.row(L.a, angle(L.alpha), angle(L.theta), qs(j, L), *ql)
137155
else:
138-
table.row(L.a, angle(L.alpha), qs(j, L), L.d)
156+
table.row(L.a, angle(L.alpha), qs(j, L), L.d, *ql)
139157
else:
140158
# DH format
141159
table = ANSITable(
142160
Column("θⱼ", headalign="^", colalign="<"),
143161
Column("dⱼ", headalign="^"),
144162
Column("aⱼ", headalign="^"),
145163
Column("⍺ⱼ", headalign="^"),
164+
*qlim_columns,
146165
border="thick"
147166
)
148167
for j, L in enumerate(self):
168+
if has_qlim:
169+
if L.isprismatic():
170+
ql = [qlim[0, j], qlim[1, j]]
171+
else:
172+
ql = [angle(qlim[k, j]) for k in [0, 1]]
173+
else:
174+
ql = []
149175
if L.isprismatic():
150176
table.row(
151-
angle(L.theta), qs(j, L), L.a, angle(L.alpha * deg))
177+
angle(L.theta), qs(j, L), L.a, angle(L.alpha), *ql)
152178
else:
153-
table.row(qs(j, L), L.d, L.a, angle(L.alpha))
179+
table.row(qs(j, L), L.d, L.a, angle(L.alpha), *ql)
154180

155181
s = str(table)
156182

@@ -2515,12 +2541,13 @@ def __init__(self, *args, **kwargs):
25152541
import roboticstoolbox as rtb
25162542
# import spatialmath.base.symbolic as sym
25172543

2518-
puma = rtb.models.DH.Planar2()
2544+
planar = rtb.models.DH.Planar2()
25192545
# J = puma.jacob0(puma.qn)
25202546
# print(J)
25212547
# print(puma.manipulability(puma.qn))
25222548
# print(puma.manipulability(puma.qn, 'asada'))
25232549
#tw, T0 = puma.twists(puma.qz)
2524-
print(puma.qlim)
2525-
print(puma[0].qlim)
2526-
print(puma.islimit([0, -5]))
2550+
print(planar)
2551+
2552+
puma = rtb.models.DH.Puma560()
2553+
print(puma)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy