Skip to content

Commit 2899743

Browse files
committed
Fix mdh py plot, add tool transform to plot #344
1 parent 19eeed1 commit 2899743

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

roboticstoolbox/backends/PyPlot/RobotPlot.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ def __init__(
2222
name=True,
2323
options=None,
2424
):
25-
2625
super(RobotPlot, self).__init__()
2726

2827
# Readonly - True for this robot is for displaying only
@@ -129,7 +128,7 @@ def draw(self):
129128

130129
# add new ee coordinate frame
131130
for link in self.robot.ee_links:
132-
Te = T[link.number]
131+
Te = T[link.number] * self.robot.tool
133132

134133
# ee axes arrows
135134
Tex = Te * Tjx
@@ -156,11 +155,15 @@ def draw(self):
156155
if self.jointaxes:
157156
# Plot joint z coordinates
158157
for link in self.robot:
159-
160158
direction = None
161159
if isinstance(self.robot, rp.DHRobot):
162160
# should test MDH I think
163-
Tj = T[link.number - 1]
161+
162+
if self.robot.mdh:
163+
Tj = T[link.number]
164+
else:
165+
Tj = T[link.number - 1]
166+
164167
R = Tj.R
165168
direction = R[:, 2] # z direction
166169
elif link.isjoint:
@@ -178,7 +181,6 @@ def draw(self):
178181
self.joints.extend(arrow)
179182

180183
def init(self):
181-
182184
self.drawn = True
183185

184186
if self.env.limits is None:
@@ -203,7 +205,6 @@ def init(self):
203205
self.links = []
204206
self.sh_links = []
205207
for i in range(len(self.segments)):
206-
207208
# Plot the shadow of the robot links, draw first so robot is always
208209
# in front
209210
if self.shadow:

0 commit comments

Comments
 (0)