forked from alexdu/sketch-lib
-
Notifications
You must be signed in to change notification settings - Fork 1
/
kinematics.sk
173 lines (142 loc) · 6.02 KB
/
kinematics.sk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
## An example of kinematics diagram for a 6-DOF robot arm
##
## Author : Alex Dumitrache <alex@cimr.pub.ro>
## License: GPL
def blue<>
input{lib/defaults.sk}
input{lib/objects.sk}
def J1 0
def J2 -90
def J3 180
def J4 0
def J5 90
def J6 90
def arrowarc
{
sweep [style=thick]{215, rotate(1, [Z])} (1,0)
def p1 (1,0) then rotate(210, [Z])
def p2 (1,0) then rotate(210+30, [Z])
line [style=thick, style=->] (p1)(p2)
}
% The main drawing
put {scale(0.5)}
{
# base
put {scale(1)}
{
put{scale([8,8,0.5])}{box}
put{scale(1.5) * translate([0,0,0.2])}
{
{coordsys}
special |\path #1 node[left] {$Z_0$}
#2 node[below] {$X_0$}
#3 node[right] {$Y_0$};|(z)(x)(y)(o)
}
put {translate([0,0,4]) * rotate(135, [Z])}{arrowarc}
special|\node[right] at #1 {$\theta_1$};|(1,0,4)
line [style=dashed] (0,0,0.2)(0,0,12)
# link1
put {translate([0,0,7]) * rotate(J1, [Z])}
{
put{scale([1,1,3])}{cylinder}
put{translate([0,0,6]) * rotate(-90, [X])}
{
put{scale([2.5,2.5,4])}
{
{coordsys}
special |\path #1 node[above] {$Z_1$}
#2 node[right] {$X_1$}
#3 node[right] {$Y_1$};|(z)(x)(y)(o)
}
put {translate([0,0,-4]) * rotate(30, [Z])}{arrowarc}
special|\node at #1 {$\theta_2$};|(0,0,-4)
}
# link2
put {translate([0,0,6]) * rotate(-90, [X]) * rotate(J2+90, [Z])}
{
put{scale([1,1,3])}{cylinder}
put{translate([0,-7,0]) * rotate(-90, [Z])}
{
put {scale([3,4.5,6])}
{
{coordsys}
special |\path #1 node[above] {$Z_2$}
#2 node[left] {$X_2$}
#3 node[below] {$Y_2$};|(z)(x)(y)(o)
}
put {translate([0,0,-4]) * rotate(120, [Z])}{arrowarc}
special|\node at #1 {$\theta_3$};|(0,0,-4)
}
line [style=dashed] (0,0,0)(0,-7,0)
# link3
put {translate([0,-7,0]) * rotate(J3-180, [Z]) * rotate(90, [Y]) * rotate(90, [Z])}
{
put{rotate(90, [X]) * scale([1,1,3])}{cylinder}
put{scale([3,4,2.5])}
{
{coordsys}
special |\path #1 node[below] {$Z_3$}
#2 node[left] {$X_3$}
#3 node[above=1pt] {$Y_3$};|(z)(x)(y)(o)
}
put {translate([0,0,6]) * rotate(0, [Z])}{arrowarc}
special|\node[above] at #1 {$\theta_4$};|(-1,0,6)
line [style=dashed] (0,0,0)(0,0,16)
# link4
put {translate([0,0,9.5]) * rotate(180+J4, [Z])}
{
put{scale([1,1,3])}{cylinder}
# link5
put {translate([0,0,6.5]) * rotate(-90, [X]) * rotate(180, [Y])}
{
put{scale([1,1,3])}{cylinder}
put{scale([2.5,3,4])}
{
{coordsys}
special |\path #1 node[right] {$Z_4$}
#2 node[right] {$X_4$}
#3 node[above] {$Y_4$};|(z)(x)(y)(o)
}
put {translate([0,0,-4]) * rotate(-60, [Z])}{arrowarc}
special|\node at #1 {$\theta_5$};|(0,0,-4)
# link6
put {rotate(J5-90, [Z]) * translate([5,0,0]) * rotate(90, [Y]) * rotate(90, [Z])}
{
line [style=dashed] (0,0,7.25)(0,0,-5)
put{scale([1,1,3])}{cylinder}
put{scale([2.5,3,3])}
{
{coordsys}
special |\path #1 node[right] {$Z_5$}
#2 node[left] {$X_5$}
#3 node[right] {$Y_5$};|(z)(x)(y)(o)
}
put {translate([0,0,4.3]) * rotate(150, [Z])}{arrowarc}
special|\node[left] at #1 {$\theta_6$};|(1,0,4.3)
# end effector
put {rotate(J6, [Z]) * translate([0,0,6])}
{
put{scale([1,2,1])}{box}
put{translate([0,-0.7,1]) * scale([1,0.2,1])}{box}
put{translate([0,0.7,1]) * scale([1,0.2,1])}{box}
put{translate([0,0,1.25]) * scale([4,3,2.5])}
{
{coordsys}
special |\path #1 node[right] {$Z_6$}
#2 node[right] {$X_6$}
#3 node[right] {$Y_6$};|(z)(x)(y)(o)
}
}
}
}
}
}
}
}
}
}
global
{
language tikz
camera rotate(0, (1,0,0)) * view((1.5,2,1),(0,0,0),[0,0,1]) * rotate(110, (0,0,1))
}