-
Notifications
You must be signed in to change notification settings - Fork 1
/
utils.py
60 lines (51 loc) · 1.25 KB
/
utils.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
"""
utils.py contains constants and helpful functions.
"""
import os
HOME_PATH = "/home/pi"
ACS_PATH = HOME_PATH + "/ACS_2023"
DATA_PATH = ACS_PATH + "/_data"
LOGS_PATH = ACS_PATH + "/_logs"
HEADERS = [
"#",
"Time",
"State",
"Altitude",
"BMP_Altitude",
"ADXL_Acceleration_X",
"ADXL_Acceleration_Y",
"ADXL_Acceleration_Z",
"IMU_Acceleration_X",
"IMU_Acceleration_Y",
"IMU_Acceleration_Z",
"Linear_Acceleration_X",
"Linear_Acceleration_Y",
"Linear_Acceleration_Z",
"Euler_Angle_X",
"Euler_Angle_Y",
"Euler_Angle_Z",
"Gravity_X",
"Gravity_Y",
"Gravity_Z",
"Kalman_Acceleration",
"Kalman_Velocity",
"Kalman_Altitude",
"Orientation(Beta)",
"Servo_Angle",
"Target_Servo_Angle",
"Projected_Apogee",
"Error_Apogee"
]
LAUNCH_ACCELERATION = 50 # m/s^2
LAUNCH_ALTITUDE = 50 # m
BURNOUT_ACCELERATION = -6 # m/s^2
APOGEE_VELOCITY = 0 # m/s
APOGEE_ALTITUDE = 1402 # m
def file_number() -> str:
data_path = ACS_PATH + "/_data"
csvs = [file for file in os.listdir(data_path) if file.endswith("csv")]
if not csvs:
return "00"
csvs = [csv[5:].removesuffix(".csv") for csv in csvs]
nums = map(int, csvs)
return str(max(nums) + 1).zfill(2)