8000 ETS display formatting, sym friendliness · A905275/robotics-toolbox-python@7baf4e1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7baf4e1

Browse files
committed
ETS display formatting, sym friendliness
1 parent ebf1aed commit 7baf4e1

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

roboticstoolbox/robot/ETS.py

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,10 @@ def eval(self, q=None, unit='rad'):
523523

524524
# optionally do symbolic simplification
525525

526-
return T.simplify()
526+
if T.A.dtype == 'O':
527+
T = T.simplify()
528+
529+
return T
527530

528531
def compile(self):
529532
"""
@@ -658,22 +661,25 @@ def __str__(self, q=None):
658661

659662
elif et.isrevolute:
660663
if issymbol(et.eta):
661-
s = f"{et.axis}({et.eta})"
664+
s = f"{et.axis}({et.eta:.4g})"
662665
else:
663666
s = f"{et.axis}({et.eta * 180 / np.pi:.4g}°)"
664667

665668
elif et.isprismatic:
666-
s = f"{et.axis}({et.eta})"
669+
s = f"{et.axis}({et.eta:.4g})"
667670

668671
elif et.isconstant:
669672
s = f"C{c}"
670673
c += 1
671674

672675
es.append(s)
673676

674-
return " * ".join(es)
677+
return " \u2295 ".join(es)
675678

676679
# redefine * operator to concatenate the internal lists
680+
def __add__(self, rest):
681+
self.__mul__(rest)
682+
677683
def __mul__(self, rest):
678684
"""
679685
Overloaded ``*`` operator
@@ -1663,19 +1669,28 @@ def jacobe(self, q=None, T=None):
16631669
# print(e)
16641670
# print(e.compile())
16651671

1666-
b = ETS2.r(flip=True) * ETS2.tx(1) * ETS2.r() * ETS2.tx(1)
1672+
# b = ETS2.r(flip=True) * ETS2.tx(1) * ETS2.r() * ETS2.tx(1)
1673+
1674+
# J = b.jacob0([0,0])
1675+
# print(J)
1676+
1677+
# J = b.jacobe([0,0])
1678+
# print(J)
1679+
1680+
# J = b.jacob0([1,0])
1681+
# print(J)
1682+
1683+
# J = b.jacobe([1,0])
1684+
# print(J)
16671685

1668-
J = b.jacob0([0,0])
1669-
print(J)
16701686

1671-
J = b.jacobe([0,0])
1672-
print(J)
1687+
from roboticstoolbox import ETS2 as ET
16731688

1674-
J = b.jacob0([1,0])
1675-
print(J)
1689+
a1 = 1
1690+
E = ET.r() * ET.tx(a1)
16761691

1677-
J = b.jacobe([1,0])
1678-
print(J)
1692+
v = E.eval( 30, unit='deg')
1693+
print(v)
16791694

16801695
# b = ETS.ry(flip=True) * ETS.tx(1) * ETS.ry() * ETS.tx(1)
16811696

0 commit comments

Comments
 (0)
0