Load IMU Data Files

This commit is contained in:
Cal Wing 2023-10-22 17:25:20 +10:00
parent 59b4c61aaa
commit 4765148806
2 changed files with 39 additions and 6 deletions

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
}

42
main.py
View File

@ -1,28 +1,58 @@
# Aero4200-Ass3
# Cal
#
# Cal Wing, Sem 2 2023
# Import System / Common Libs
import os, time
import numpy as np
import pandas as pd
from tqdm import tqdm
#Import MakeGraph, a custom graphing wrapper I developed, refer to it for documentation
from makeGraph import makeGraph, pltKeyClose, UQ_COLOURS as UQC # Custom Graphing Lib
# Override Sin & Cos to use & return degrees
#def sin(angle): return np.sin(np.deg2rad(angle))
#def cos(angle): return np.cos(np.deg2rad(angle))
# Make sure the relevant folders folder exists
#folders = ["./images", "./tmp", "./data"]
folders = ["./images"]
for folder in folders:
if not os.path.isdir(folder): os.mkdir(folder)
# IMU Data Loading
# I map in to a heading to add units / make things make more sense
## The gyroscopic body angular rates from the IMU are given:
# - WBE_1 (in rad/s) - the roll rate about the body-fixed x-axis
# - WBE_2 (in rad/s) - the pitch rate about the body-fixed y-axis
# - WBE_3 (in rad/s) - the yaw rate about the body-fixed z-axis
## Specific forces:
# - FSP_X (in m/s2) - the specific force in the body-fixed x-direction
# - FSP_Y (in m/s2) - the specific force in the body-fixed y-direction
# - FSP_Z (in m/s2) - the specific force in the body-fixed z-direction
IMU_DATA_HEADER = [
"Time [s]",
"WBE_1 [rad/s]", "WBE_2 [rad/s]", "WBE_3 [rad/s]",
"FSP_X [m/s^2]", "FSP_Y [m/s^2]", "FSP_Z [m/s^2]"
]
def importIMUData(mission, imu):
# If IMU is not a string, then convert based on bool eval where "H" == True
if type(imu) != str: imu = "H" if imu else "L"
return pd.read_csv(
f"./data/IMU_M{str(mission) + str(imu)}.txt",
header=None, skiprows=1,
names=IMU_DATA_HEADER,
dtype=[float, float, float, float, float, float, float],
)
m1_IMUData = importIMUData(1, 0), importIMUData(1, 1) #(L, H) Data
m2_IMUData = importIMUData(2, 0), importIMUData(2, 1)
if __name__ == '__main__':
pass
input("Damn")
if __name__ == '__main__1':
#This is an example of drawing 4 plots by generating them