This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.py
136 lines (126 loc) · 3.32 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
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
from enum import Enum
# Register Addresses
MODE1 = 0x00
MODE2 = 0x01
SUBADR1 = 0x02
SUBADR2 = 0x03
SUBADR3 = 0x04
ALLCALLADR = 0x05
LED0_ON_L = 0x06
LED0_ON_H = 0x07
LED0_OFF_L = 0x08
LED0_OFF_H = 0x09
LED1_ON_L = 0x0A
LED1_ON_H = 0x0B
LED1_OFF_L = 0x0C
LED1_OFF_H = 0x0D
LED2_ON_L = 0x0E
LED2_ON_H = 0x0F
LED2_OFF_L = 0x10
LED2_OFF_H = 0x11
LED3_ON_L = 0x12
LED3_ON_H = 0x13
LED3_OFF_L = 0x14
LED3_OFF_H = 0x15
LED4_ON_L = 0x16
LED4_ON_H = 0x17
LED4_OFF_L = 0x18
LED4_OFF_H = 0x19
LED5_ON_L = 0x1A
LED5_ON_H = 0x1B
LED5_OFF_L = 0x1C
LED5_OFF_H = 0x1D
LED6_ON_L = 0x1E
LED6_ON_H = 0x1F
LED6_OFF_L = 0x20
LED6_OFF_H = 0x21
LED7_ON_L = 0x22
LED7_ON_H = 0x23
LED7_OFF_L = 0x24
LED7_OFF_H = 0x25
LED8_ON_L = 0x26
LED8_ON_H = 0x27
LED8_OFF_L = 0x28
LED8_OFF_H = 0x29
LED9_ON_L = 0x2A
LED9_ON_H = 0x2B
LED9_OFF_L = 0x2C
LED9_OFF_H = 0x2D
LED10_ON_L = 0x2E
LED10_ON_H = 0x2F
LED10_OFF_L = 0x30
LED10_OFF_H = 0x31
LED11_ON_L = 0x32
LED11_ON_H = 0x33
LED11_OFF_L = 0x34
LED11_OFF_H = 0x35
LED12_ON_L = 0x36
LED12_ON_H = 0x37
LED12_OFF_L = 0x38
LED12_OFF_H = 0x39
LED13_ON_L = 0x3A
LED13_ON_H = 0x3B
LED13_OFF_L = 0x3C
LED13_OFF_H = 0x3D
LED14_ON_L = 0x3E
LED14_ON_H = 0x3F
LED14_OFF_L = 0x40
LED14_OFF_H = 0x41
LED15_ON_L = 0x42
LED15_ON_H = 0x43
LED15_OFF_L = 0x44
LED15_OFF_H = 0x45
ALLLED_ON_L = 0xFA
ALLLED_ON_H = 0xFB
ALLLED_OFF_L = 0xFC
ALLLED_OFF_H = 0xFD
PRESCALE = 0xFE
# Channels
CHANNEL0 = [LED0_ON_L, LED0_ON_H, LED0_OFF_L, LED0_OFF_H]
CHANNEL1 = [LED1_ON_L, LED1_ON_H, LED1_OFF_L, LED1_OFF_H]
CHANNEL2 = [LED2_ON_L, LED2_ON_H, LED2_OFF_L, LED2_OFF_H]
CHANNEL3 = [LED3_ON_L, LED3_ON_H, LED3_OFF_L, LED3_OFF_H]
CHANNEL4 = [LED4_ON_L, LED4_ON_H, LED4_OFF_L, LED4_OFF_H]
CHANNEL5 = [LED5_ON_L, LED5_ON_H, LED5_OFF_L, LED5_OFF_H]
CHANNEL6 = [LED6_ON_L, LED6_ON_H, LED6_OFF_L, LED6_OFF_H]
CHANNEL7 = [LED7_ON_L, LED7_ON_H, LED7_OFF_L, LED7_OFF_H]
CHANNEL8 = [LED8_ON_L, LED8_ON_H, LED8_OFF_L, LED8_OFF_H]
CHANNEL9 = [LED9_ON_L, LED9_ON_H, LED9_OFF_L, LED9_OFF_H]
CHANNEL10 = [LED10_ON_L, LED10_ON_H, LED10_OFF_L, LED10_OFF_H]
CHANNEL11 = [LED11_ON_L, LED11_ON_H, LED11_OFF_L, LED11_OFF_H]
CHANNEL12 = [LED12_ON_L, LED12_ON_H, LED12_OFF_L, LED12_OFF_H]
CHANNEL13 = [LED13_ON_L, LED13_ON_H, LED13_OFF_L, LED13_OFF_H]
CHANNEL14 = [LED14_ON_L, LED14_ON_H, LED14_OFF_L, LED14_OFF_H]
CHANNEL15 = [LED15_ON_L, LED15_ON_H, LED15_OFF_L, LED15_OFF_H]
# ODROID DIGITAL INPUT PINS
GPIO_IN = [15, 16, 1, 4, 5, 6, 10, 11]
# ODROID DIGITAL OUTPUT PINS
GPIO_OUT = [7, 0, 2, 3, 12, 13, 14, 30, 21, 22]
# CONTROL MODE
class DriverControlMode(Enum):
IDLE = 0
DRIVE = 1
WINCH = 2
CLAW = 3
# DUTY CYCLE THRESHOLD
MAX_DC = 95
MIN_DC = 12
WINCH_DC_SPEED = 50
ACTUATOR_DC_MIN = 30
ACTUATOR_DC_MAX = 60
# JOYSTICK THRESHOLDS
THRESHOLD_HIGH = 0.2
THRESHOLD_LOW = -0.2
ACCEL_MULTIPLIER = 2.0
# I2C parameter defaults
I2C_BUS = 0
I2C_DEV = "/dev/i2c-0"
I2C_CHIP = 0x40
# PCA9685
FREQUENCY=300
COUNT_SIZE = 4096.0
CLK = 25000000.0
# JOYSTICK TEMP
MAX_RANGE = 4095
MIN_RANGE = 0
CENTER_POS = round(4095/2)