8000 presentation fixes · lordkeks/robotics-toolbox-python@5a2fe22 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5a2fe22

Browse files
committed
presentation fixes
1 parent 7e1fbf4 commit 5a2fe22

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

roboticstoolbox/robot/serial_link.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from roboticstoolbox.robot.Link import *
55
from spatialmath.pose3d import *
66
from scipy.optimize import minimize
7+
from graphics.graphics_test_features import *
78

89
class SerialLink:
910

@@ -95,7 +96,7 @@ def fkine(self, jointconfig, unit='rad', alltout=False):
9596
t[k] = tt * SE3(self.tool)
9697

9798
if alltout:
98-
return t, allt
99+
return allt
99100
else:
100101
return t
101102

@@ -128,26 +129,24 @@ def objective(x):
128129
else:
129130
return sol.x
130131

132+
def plot(self, jointconfig, unit='rad'):
133+
134+
if type(jointconfig) == list:
135+
jointconfig = argcheck.getvector(jointconfig)
136+
if unit == 'deg':
137+
jointconfig = jointconfig * pi / 180
138+
if jointconfig.size == self.length:
139+
poses = self.fkine(jointconfig, unit, alltout=True)
140+
t = list(range(len(poses)))
141+
for i in range(len(poses)):
142+
t[i] = poses[i].t
143+
# add the base
144+
t.insert(0, SE3(self.base).t)
145+
grjoints = list(range(len(t)))
131146

147+
canvas_grid = init_canvas()
132148

133-
def plot(self, jointconfig, unit='rad'):
149+
for i in range(1, len(t)):
150+
grjoints[i] = RotationalJoint(vector(t[i-1][0], t[i-1][1], t[i-1][2]), vector(t[i][0], t[i][1], t[i][2]))
134151

135-
# if type(jointconfig) == list:
136-
# jointconfig = argcheck.getvector(jointconfig)
137-
# if unit == 'deg':
138-
# jointconfig = jointconfig * pi / 180
139-
# # if no trajectory joint config just call fkine for pose
140-
# if jointconfig.size == self.length:
141-
# endpose = self.fkine(jointconfig, unit, alltout=True)
142-
# else:
143-
# assert jointconfig.shape[1] == self.length, "joinconfig must have {self.length} columns"
144-
# t = list(range(0, jointconfig.shape[0]))
145-
#
146-
# for j in range(jointconfig.shape[1]):
147-
# jset = jointconfig[:, j]
148-
# for k in range(jointconfig.shape[0]):
149-
# row = jointconfig[k, :]
150-
# tt = SE3(self.base)
151-
# for i in range(self.length):
152-
# tt = tt * self.links[i].A(row[i])
153-
# t[k] = tt * SE3(self.tool)
152+
x = GraphicalRobot(grjoints)

0 commit comments

Comments
 (0)
0