-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.py
62 lines (54 loc) · 1.57 KB
/
constants.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
"""
Constants used accross multiple project files.
Not expected to be changed frequently.
"""
from dataclasses import dataclass
import numpy as np
import config
g = 9.81
EPSILON = 0.001
IN_TO_M = 0.0254
v_stiction=1e-3
# Dimensions of physical pieces
THIN_PLYWOOD_THICKNESS = IN_TO_M*3/8
THICK_PLYWOOD_THICKNESS = IN_TO_M*3/4
PLYWOOD_LENGTH = IN_TO_M*12
PLYWOOD_DENSITY = 500 # kg/m^3
Nm__PER_InLb = 0.112984833 # McMaster uses imperial units to a fault
def stiffness_Nm_per_Rad(num_links: config.NumLinks):
if num_links == config.NumLinks.TWO:
stiffness__InLb_per_Rad__2_links = 6*0.55/(np.pi)
return Nm__PER_InLb*stiffness__InLb_per_Rad__2_links
if num_links == config.NumLinks.FOUR:
stiffness__InLb_per_Rad__4_links = 40/(np.pi)
return Nm__PER_InLb*stiffness__InLb_per_Rad__4_links
def PEDESTAL_X_DIM(num_links: config.NumLinks):
if num_links == config.NumLinks.TWO:
return PLYWOOD_LENGTH/2
if num_links == config.NumLinks.FOUR:
return PLYWOOD_LENGTH/4
@dataclass
class SystemConstants:
"""
Constants for this particular plant + manipulator
"""
w_L: float
h_L: float
m_L: float
m_M: float
b_J: float
k_J: float
mu: float
r: float
def nominal_sys_consts(num_links):
return SystemConstants(
w_L = PEDESTAL_X_DIM(num_links),
h_L = THIN_PLYWOOD_THICKNESS,
m_L = PLYWOOD_LENGTH*PEDESTAL_X_DIM(num_links)*\
THIN_PLYWOOD_THICKNESS*PLYWOOD_DENSITY,
m_M = 1e-3,
b_J = 0.035,
k_J = 0.35,
mu = 0.4,
r = 0.05,
)