8000 add config string and joint config table display · stonebig/robotics-toolbox-python@12d2a45 · GitHub
[go: up one dir, main page]

Skip to content

Commit 12d2a45

Browse files
committed
add config string and joint config table display
1 parent cc56130 commit 12d2a45

File tree

1 file changed

+40
-18
lines changed

1 file changed

+40
-18
lines changed

roboticstoolbox/robot/ERobot.py

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,8 @@ def base_link(self, link):
491491
raise ValueError('must be an ELink')
492492
# self._reset_fk_path()
493493
# --------------------------------------------------------------------- #
494+
# TODO get configuration string
495+
494496

495497
@property
496498
def ee_links(self):
@@ -556,6 +558,16 @@ def ets(self, ee=None):
556558

557559
return ets
558560

561+
def config(self):
562+
s = ''
563+
for link in self.links:
564+
if link.v is not None:
565+
if link.v.isprismatic:
566+
s += 'P'
567+
elif link.v.isrevolute:
568+
s += 'R'
569+
return s
570+
559571
# --------------------------------------------------------------------- #
560572

561573
# def fkine(self, q=None):
@@ -1123,7 +1135,11 @@ def __str__(self):
11231135
link.parent.name if link.parent is not None else "-",
11241136
link._joint_name if link.parent is not None else "",
11251137
ets.__str__(f"q{link._jindex}"))
1126-
return str(table)
1138+
1139+
s = str(table)
1140+
s += self.configurations_str()
1141+
1142+
return s
11271143

11281144
def hierarchy(self):
11291145
"""
@@ -1844,20 +1860,26 @@ def collided(self, shape):
18441860
import roboticstoolbox as rtb
18451861
np.set_printoptions(precision=4, suppress=True)
18461862

1847-
robot = rtb.models.ETS.Panda()
1848-
print(robot)
1849-
print(robot.base, robot.tool)
1850-
print(robot.ee_links)
1851-
ets = robot.ets()
1852-
print(ets)
1853-
print('n', ets.n)
1854-
ets2 = ets.compile()
1855-
print(ets2)
1856-
1857-
q = np.random.rand(7)
1858-
# print(ets.eval(q))
1859-
# print(ets2.eval(q))
1860-
1861-
J1 = robot.jacob0(q)
1862-
J2 = ets2.jacob0(q)
1863-
print(J1-J2)
1863+
p=rtb.models.URDF.Panda()
1864+
print(p[1].m)
1865+
1866+
# robot = rtb.models.ETS.Panda()
1867+
# print(robot)
1868+
# print(robot.base, robot.tool)
1869+
# print(robot.ee_links)
1870+
# ets = robot.ets()
1871+
# print(ets)
1872+
# print('n', ets.n)
1873+
# ets2 = ets.compile()
1874+
# print(ets2)
1875+
1876+
# q = np.random.rand(7)
1877+
# # print(ets.eval(q))
1878+
# # print(ets2.eval(q))
1879+
1880+
# J1 = robot.jacob0(q)
1881+
# J2 = ets2.jacob0(q)
1882+
# print(J1-J2)
1883+
1884+
# print(robot[2].v, robot[2].v.jindex)
1885+
# print(robot[2].Ts)

0 commit comments

Comments
 (0)
0