8000 Create serial_link_plot_old.py · navrobot/robotics-toolbox-python@9ac5543 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9ac5543

Browse files
committed
Create serial_link_plot_old.py
here it is micah
1 parent 31fdf7b commit 9ac5543

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

graphics/serial_link_plot_old.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
def plot(self, jointconfig, unit='rad'):
2+
"""
3+
Creates a 3D plot of the robot in your web browser
4+
:param jointconfig: takes an array or list of joint angles
5+
:param unit: unit of angles. radians if not defined
6+
:return: a vpython robot object.
7+
"""
8+
if type(jointconfig) == list:
9+
jointconfig = argcheck.getvector(jointconfig)
10+
if unit == 'deg':
11+
jointconfig = jointconfig * pi / 180
12+
if jointconfig.size == self.length:
13+
poses = self.fkine(jointconfig, unit, alltout=True)
14+
t = list(range(len(poses)))
15+
for i in range(len(poses)):
16+
t[i] = poses[i].t
17+
# add the base
18+
t.insert(0, SE3(self.base).t)
19+
grjoints = list(range(len(t) - 1))
20+
21+
canvas_grid = init_canvas()
22+
23+
for i in range(1, len(t)):
24+
grjoints[i - 1] = RotationalJoint(vector(t[i - 1][0], t[i - 1< 516B /span>][1], t[i - 1][2]),
25+
vector(t[i][0], t[i][1], t[i][2]))
26+
print(grjoints)
27+
x = GraphicalRobot(grjoints)
28+
29+
return x

0 commit comments

Comments
 (0)
0