Potentially Fix Graphs? (dt calcs where inverted)
This commit is contained in:
parent
faa2400d4f
commit
188737b05a
33
main.py
33
main.py
@ -134,15 +134,15 @@ TRANS_DATA_HEADER = IMU_TIME_HEADER + IMU_WBE_HEADERS + NED_ACCELERATION_HEADER
|
|||||||
def calculateVelocityPosition(missionData, initial_values) -> pd.DataFrame:
|
def calculateVelocityPosition(missionData, initial_values) -> pd.DataFrame:
|
||||||
print("Translating Motion & Calculating Resulting Forces")
|
print("Translating Motion & Calculating Resulting Forces")
|
||||||
|
|
||||||
offset = initial_values
|
offset = initial_values.copy()
|
||||||
|
|
||||||
translatedData = pd.DataFrame(columns=TRANS_DATA_HEADER)
|
translatedData = pd.DataFrame(columns=TRANS_DATA_HEADER)
|
||||||
for i in tqdm(range(len(missionData))):
|
for i in tqdm(range(len(missionData))):
|
||||||
mData = lambda header, j=i: missionData[header].iloc[j].values
|
mData = lambda header, j=i: missionData.loc[j, header].values
|
||||||
dt = mData(IMU_TIME_HEADER, i-1)[0] - mData(IMU_TIME_HEADER, i)[0] if i > 0 else mData(IMU_TIME_HEADER, i)[0] - mData(IMU_TIME_HEADER, i+1)[0]
|
dt = mData(IMU_TIME_HEADER, i)[0] - mData(IMU_TIME_HEADER, i-1)[0] if i > 0 else mData(IMU_TIME_HEADER, i+1)[0] - mData(IMU_TIME_HEADER, i)[0]
|
||||||
|
|
||||||
# Get the time point data
|
# Get the time point data
|
||||||
dataPoint = missionData[IMU_WBE_HEADERS].iloc[i]
|
dataPoint = missionData.loc[i, IMU_WBE_HEADERS]
|
||||||
|
|
||||||
# Translate to NED Frame
|
# Translate to NED Frame
|
||||||
NED_attitude_rate = attitude_rate_2NED(dataPoint.values, INIT_EULER_ANGLES)
|
NED_attitude_rate = attitude_rate_2NED(dataPoint.values, INIT_EULER_ANGLES)
|
||||||
@ -151,7 +151,7 @@ def calculateVelocityPosition(missionData, initial_values) -> pd.DataFrame:
|
|||||||
NED_velocity = NED_acceleration * dt + offset["velocity"]
|
NED_velocity = NED_acceleration * dt + offset["velocity"]
|
||||||
NED_position = NED_velocity * dt + offset["position"]
|
NED_position = NED_velocity * dt + offset["position"]
|
||||||
|
|
||||||
offset["attitude"] = NED_acceleration
|
offset["attitude"] = NED_attitude
|
||||||
offset["velocity"] = NED_velocity
|
offset["velocity"] = NED_velocity
|
||||||
offset["position"] = NED_position
|
offset["position"] = NED_position
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ def generateGraphs(missionData, mission):
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
makeGraph(graphData, False, False, figSavePath="./images/m{mission}_flight_pos.png")
|
makeGraph(graphData, False, False, figSavePath=f"./images/m{mission}_flight_pos.png")
|
||||||
pBar.update(1)
|
pBar.update(1)
|
||||||
|
|
||||||
graphData = {
|
graphData = {
|
||||||
@ -279,7 +279,7 @@ def generateGraphs(missionData, mission):
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
makeGraph(graphData, False, False, figSavePath="./images/m{mission}_flight_velocity.png")
|
makeGraph(graphData, False, False, figSavePath=f"./images/m{mission}_flight_velocity.png")
|
||||||
pBar.update(1)
|
pBar.update(1)
|
||||||
|
|
||||||
graphData = {
|
graphData = {
|
||||||
@ -294,45 +294,34 @@ def generateGraphs(missionData, mission):
|
|||||||
"title": "North Acceleration",
|
"title": "North Acceleration",
|
||||||
"yLabel": "Acceleration [m/s$^2$]",
|
"yLabel": "Acceleration [m/s$^2$]",
|
||||||
"plots": [
|
"plots": [
|
||||||
{"x":missionData[1][IMU_TIME_HEADER[0]], "y":missionData[1][NED_ACCELERATION_HEADER[0]], "label":"High Grade Data", "colour":"uq:blue"},
|
|
||||||
{"x":missionData[0][IMU_TIME_HEADER[0]], "y":missionData[0][NED_ACCELERATION_HEADER[0]], "label":"Low Grade Data", "colour":"uq:purple"},
|
{"x":missionData[0][IMU_TIME_HEADER[0]], "y":missionData[0][NED_ACCELERATION_HEADER[0]], "label":"Low Grade Data", "colour":"uq:purple"},
|
||||||
|
{"x":missionData[1][IMU_TIME_HEADER[0]], "y":missionData[1][NED_ACCELERATION_HEADER[0]], "label":"High Grade Data", "colour":"uq:blue"},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "East Acceleration",
|
"title": "East Acceleration",
|
||||||
"yLabel": "Acceleration [m/s$^2$]",
|
"yLabel": "Acceleration [m/s$^2$]",
|
||||||
"plots": [
|
"plots": [
|
||||||
{"x":missionData[1][IMU_TIME_HEADER[0]], "y":missionData[1][NED_ACCELERATION_HEADER[1]], "label":"High Grade Data", "colour":"uq:blue"},
|
|
||||||
{"x":missionData[0][IMU_TIME_HEADER[0]], "y":missionData[0][NED_ACCELERATION_HEADER[1]], "label":"Low Grade Data", "colour":"uq:purple"},
|
{"x":missionData[0][IMU_TIME_HEADER[0]], "y":missionData[0][NED_ACCELERATION_HEADER[1]], "label":"Low Grade Data", "colour":"uq:purple"},
|
||||||
|
{"x":missionData[1][IMU_TIME_HEADER[0]], "y":missionData[1][NED_ACCELERATION_HEADER[1]], "label":"High Grade Data", "colour":"uq:blue"},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Down Acceleration",
|
"title": "Down Acceleration",
|
||||||
"yLabel": "Acceleration [m/s$^2$]",
|
"yLabel": "Acceleration [m/s$^2$]",
|
||||||
"plots": [
|
"plots": [
|
||||||
{"x":missionData[1][IMU_TIME_HEADER[0]], "y":missionData[1][NED_ACCELERATION_HEADER[2]], "label":"High Grade Data", "colour":"uq:blue"},
|
|
||||||
{"x":missionData[0][IMU_TIME_HEADER[0]], "y":missionData[0][NED_ACCELERATION_HEADER[2]], "label":"Low Grade Data", "colour":"uq:purple"},
|
{"x":missionData[0][IMU_TIME_HEADER[0]], "y":missionData[0][NED_ACCELERATION_HEADER[2]], "label":"Low Grade Data", "colour":"uq:purple"},
|
||||||
|
{"x":missionData[1][IMU_TIME_HEADER[0]], "y":missionData[1][NED_ACCELERATION_HEADER[2]], "label":"High Grade Data", "colour":"uq:blue"},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
makeGraph(graphData, False, False, figSavePath="./images/m{mission}_flight_accell.png")
|
makeGraph(graphData, False, False, figSavePath=f"./images/m{mission}_flight_accell.png")
|
||||||
pBar.update(1)
|
pBar.update(1)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
missionData = cacheData("./tmp/m1_L_transData.dfz", calculateVelocityPosition, (m1_IMUData[0], INIT_FLIGHT_PRAMS), forceCalc=False), \
|
missionData = cacheData("./tmp/m1_L_transData.dfz", calculateVelocityPosition, (m1_IMUData[0], INIT_FLIGHT_PRAMS), forceCalc=False), \
|
||||||
cacheData("./tmp/m1_H_transData.dfz", calculateVelocityPosition, (m1_IMUData[1], INIT_FLIGHT_PRAMS), forceCalc=False)
|
cacheData("./tmp/m1_H_transData.dfz", calculateVelocityPosition, (m1_IMUData[1], INIT_FLIGHT_PRAMS), forceCalc=False)
|
||||||
|
|
||||||
generateGraphs(missionData, 1)
|
generateGraphs(missionData, 1)
|
||||||
|
|
||||||
#import matplotlib.pyplot as plt
|
|
||||||
#fig = plt.figure()
|
|
||||||
#ax = plt.axes(projection='3d')
|
|
||||||
#x, y, z = missionData[0][NED_POSITION_HEADER[0]], missionData[0][NED_POSITION_HEADER[1]], missionData[0][NED_POSITION_HEADER[2]]
|
|
||||||
#ax.plot3D(x, y, z)
|
|
||||||
#x, y, z = missionData[1][NED_POSITION_HEADER[0]], missionData[1][NED_POSITION_HEADER[1]], missionData[1][NED_POSITION_HEADER[2]]
|
|
||||||
#ax.plot3D(x, y, z)
|
|
||||||
#plt.show()
|
|
||||||
|
|
||||||
|
|
||||||
print("Complete")
|
print("Complete")
|
Loading…
x
Reference in New Issue
Block a user