-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdemo.py
65 lines (54 loc) · 1.36 KB
/
demo.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
#!/usr/bin/env python3
if __name__ == '__main__':
import pymotor as pm
lm_settings = {
'fs': 10000.0,
'max_velocity': pm.ipm(40),
'acc_mode': 'time',
'acc_value': 0.06,
'acc_smooth': True,
'con_mode': 'distance',
'con_value': pm.inch(0.02),
'dec_mode': 'acceleration',
'dec_value': 0.25,
'dec_smooth': False,
}
lm = pm.LinearMotion(lm_settings)
lm.plot()
lf_settings = {
'safety_factor': 2,
'moving_mass': 100,
'preload_force': 0.1,
'efficiency': 0.9,
'incline_angle': 45,
'friction_coef': 0.1,
'gravity': 9.8,
}
lf = pm.LinearForce(lf_settings, lm)
lf.plot()
curve_hz = [
0,
pm.rpm(300),
pm.rpm(600),
pm.rpm(900),
pm.rpm(1200),
pm.rpm(1500),
pm.rpm(1800),
]
curve_tau = [
2.5,
2.2,
1.3,
0.9,
0.7,
0.6,
0.5,
]
motor = pm.Motor(curve_hz=curve_hz, curve_tau=curve_tau, j=pm.gcm2(460))
motor.plot()
coupler = pm.Coupler(j=pm.gcm2(5))
gear = pm.Gear(ratio=2, j_in=pm.gcm2(10), j_out=pm.gcm2(15))
screw = pm.Screw(lead=pm.inch(.05), j=pm.gcm2(20))
at = pm.AngularTorque(lf, motor=motor,
coupler=coupler, gear=gear, drivetrain=screw)
at.plot()