-
Notifications
You must be signed in to change notification settings - Fork 117
/
bg.py
executable file
·73 lines (63 loc) · 1.82 KB
/
bg.py
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
from brachiograph import BrachioGraph
# Uncomment the definition you want to use.
# This is an example BrachioGraph definition. If you build a plotter as
# described in the "Get started" section of the documentation, this definition
# is likely to work well. However, you should work out your own servo
# angle/pulse-width values as described in "Improve the plotter calibration".
# angles in degrees and corresponding pulse-widths for the two arm servos
servo_1_angle_pws1 = [
[-162, 2470],
[-144, 2250],
[-126, 2050],
[-108, 1860],
[ -90, 1690],
[ -72, 1530],
[ -54, 1350],
[ -36, 1190],
[ -18, 1010],
[ 0, 840],
[ 18, 640],
]
servo_2_angle_pws2 = [
[ 0, 660],
[ 18, 840],
[ 36, 1030],
[ 54, 1180],
[ 72, 1340],
[ 90, 1490],
[108, 1640],
[126, 1830],
[144, 2000],
[162, 2200],
[180, 2410],
]
bg = BrachioGraph(
# the lengths of the arms
inner_arm=8,
outer_arm=8,
# the drawing area
bounds=(-8, 4, 8, 13),
# angles in degrees and corresponding pulse-widths for the two arm servos
servo_1_angle_pws=servo_1_angle_pws1,
servo_2_angle_pws=servo_2_angle_pws2,
# pulse-widths for pen up/down
pw_down=1200,
pw_up=1850,
)
# A "naively" calibrated plotter definition. We assume the default 10ms
# pulse-width difference = 1 degree of motor movement. If the arms appear to
# move in the wrong directions, try reversing the value of servo_1_degree_ms
# and/or servo_2_degree_ms.
# naive_bg = BrachioGraph(
# # the lengths of the arms
# inner_arm=8,
# outer_arm=8,
# # the drawing area
# bounds=(-6, 4, 6, 12),
# # relationship between servo angles and pulse-widths
# servo_1_degree_ms=-10,
# servo_2_degree_ms=10,
# # pulse-widths for pen up/down
# pw_down=1200,
# pw_up=1850,
# )