-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.py
More file actions
134 lines (114 loc) · 3.25 KB
/
constants.py
File metadata and controls
134 lines (114 loc) · 3.25 KB
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
import struct
import sys
GRAVITY = 9.80665
# States
STATE_FAULT = 0 # will cause tube run to abort
STATE_IDLE = 1 # pod is on, but not ready to be pushed
STATE_READY = 2 # pod is ready to be pushed
STATE_PUSHING = 3 # optional
STATE_COAST = 4 # optional
STATE_BRAKING = 5 # pod is applying brakes
COMPUTER = "main"
#COMPUTER = "aux"
MAIN_UDP_BATT_PORT = 4000
MAIN_UDP_IP = "192.168.0.203"
AUX_UDP_IP = "192.168.0.205"
# Spacex UDP connection info
SPACEX_UDP_IP = "192.168.0.1"
SPACEX_UDP_PORT = 3000
# Suspension UDP connection info
SUSPENSION_UDP_IP = "192.168.0.10"
SUSPENSION_UDP_PORT = 3000
# Local mysql db connection info
MYSQL_HOST = "localhost"
MYSQL_USER = "root"
MYSQL_PASSWORD = "password"
MYSQL_DB = "gatorloop"
TIME_FORMAT = "%Y-%m-%d %T:%f"
# Sensor related
BMS_PORT = 2001
# In meters
WHEEL_CIRCUMFERENCE = 1.835
WHEEL_1_DIST = 0
WHEEL_2_DIST = 0
TOTAL_STRIPES = 0
NUM_STRIPES_BRAKE = 3
NUM_STRIPES_PANIC = 3
DIST_BRAKE = 1000
READ_ROOF = 1
READ_WHEEL = 1
READ_ACC = 1
COAST_DETECT = 1
"""
Minimum Y direction G force that we consider the pod to be in the push state
"""
MIN_PUSH_ACCELERATION = 0
"""
Total time that the pusher is active (in seconds)
"""
TOTAL_PUSH_TIME = 60.0
# Amount of time to wait for a speed update to consider that the pod is no longer moving
SPEED_UPDATE_TIMEDIFF_SEC = 2
# Battery Voltages
LOW_BATTERY = 32000
HIGH_BATTERY = 44000
# Battery temperature sensors
MAIN_BATTERY_1 = "28-0416513911ff"
MAIN_BATTERY_2 = "28-03164546f2ff"
MAIN_BATTERY_3 = "28-041650bd37ff"
AUX_BATTERY_1 = "28-041652b584ff"
AUX_BATTERY_2 = "28-0416508ce6ff"
AUX_BATTERY_3 = "28-0316457ef7ff"
# Battery Temp Limits
BATTERY_MAX_TEMP = 65
BATTERY_LOW_TEMP = -20
# Arduino
OK = "RUOK"
ENGAGE_MAIN_BRAKES = "EM"
ENGAGE_AUXILIARY_BRAKES = "EA"
RELEASE_MAIN_BRAKES = "RM"
RELEASE_AUXILIARY_BRAKES = "RA"
LOWER_LINEAR_ACTUATORS = "LL"
RAISE_LINEAR_ACTUATORS = "RL"
FORWARD = "FW"
BACKWARD = "BW"
OFF_BRAKES = "OM"
OFF_AUXILIARY = "OA"
OFF_LINEAR_ACTUATORS = "OL"
STOPPED = "STOPPED"
KILL_ALL = "KILLALL"
RUNNING = "RUNNING"
STATUS = "STATUS"
KILL_POD = "KILLPOD"
BLDC_BRAKE = "BK"
PULSE_MAIN_BRAKES = "PM"
PULSE_AUXILIARY_BRAKES = "PA"
# Optical Sensor
RIGHT_WHEEL_OK_RESPONSE = "imokwr\n"
LEFT_WHEEL_OK_RESPONSE = "imokwl\n"
ROOF_OK_RESPONSE = "imoks\n"
# Suspension codes
network_endinanness = '>'
ping_message_req = struct.pack(network_endinanness+'BB', 0x10, 0)
start_scu_message_req = struct.pack(network_endinanness+'BB', 0x11, 0)
start_logging_message_req = struct.pack(network_endinanness+'BB', 0x12, 0)
stop_logging_message_req = struct.pack(network_endinanness+'BB', 0x13, 0)
stop_scu_message_req = struct.pack(network_endinanness+'BB', 0x14, 0)
available_space_message_req = struct.pack(network_endinanness+'BB', 0x15, 0) # Not implemented yet
clear_logs_message_req = struct.pack(network_endinanness+'BB', 0x16, 0) # Not implemented yet
heartbeat_message_reply = struct.pack(network_endinanness+'BBH', 0x57, 2, 0)
# Brake values
DISTANCE_TO_BEAM = 15
IBEAM_WIDTH = 10.8
ACTUATION_RATIO = 104.4
TIME_TO_BEAM = 1589
"""
End of tube = 4224 ft
Have to stop = 4124 ft
150 ft of margin for error = 4124 - 150 = 3974 ft
3974 ft = 1211.275 meters
"""
STOPPED_DISTANCE = 2000
EXPECTED_BRAKING_DECELERATION = 1.4
# interval we check braking ( in seconds )
BRAKING_SAMPLE_TIME = 0.2