Skip to content

Issue94-v3.3 IMU datalines fail resilience check #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified AMP Log Analiser x1.v12.suo
Binary file not shown.
2 changes: 2 additions & 0 deletions AMP Log Analiser x1/AMP Log Analiser x1.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@
<Compile Include="Classes\modGPS_Checks.vb" />
<Compile Include="Classes\modGPS_Functions.vb" />
<Compile Include="Classes\modIMU_Checks.vb" />
<Compile Include="Classes\modIMU_Checks_v3_1_v3_2.vb" />
<Compile Include="Classes\modIMU_Checks_v3_3.vb" />
<Compile Include="Classes\modMainReadFile.vb" />
<Compile Include="Classes\modMODE_MainAnalysis.vb" />
<Compile Include="Classes\modMODE_Checks_v3_3.vb" />
Expand Down
178 changes: 82 additions & 96 deletions AMP Log Analiser x1/Classes/modIMU_Checks.vb
Original file line number Diff line number Diff line change
@@ -1,101 +1,87 @@
Module modIMU_Checks
Public Sub IMU_Checks()

Public Sub IMU_MainAnalysis()

If frmMainForm.chkboxVibrations.Checked = True Then
If DataArray(0) = "IMU" Then
'An IMU value should have only 7 pieces of numeric data!
If ReadFileResilienceCheck(7) = True Then
'Debug.Print("IMU Data Detected...")
Log_IMU_TimeMS = Val(DataArray(1))
Log_IMU_GyrX = Val(DataArray(2))
Log_IMU_GyrY = Val(DataArray(3))
Log_IMU_GyrZ = Val(DataArray(4))
Log_IMU_AccX = Val(DataArray(5))
Log_IMU_AccY = Val(DataArray(6))
Log_IMU_AccZ = Val(DataArray(7))

'Debug.Print("DataArray(7) = " & DataArray(7))

'Are we in flight and either hovering or flying very slow above 3 meters? (Log_GPS_Spd in m/s)
Dim TempAlt As Single = 0
'set the Vibration variables based on the form Vibration Variables.
Dim intVibrationSpeed As Integer
Dim intVibrationAltitude As Integer
If IsNumeric(frmMainForm.txtVibrationSpeed.Text) = True Then
intVibrationSpeed = Val(frmMainForm.txtVibrationSpeed.Text)
Else
intVibrationSpeed = 1
End If
If IsNumeric(frmMainForm.txtVibrationAltitude.Text) = True Then
intVibrationAltitude = Val(frmMainForm.txtVibrationAltitude.Text)
Else
intVibrationAltitude = 3
End If

If CTUN_Logging = True Then TempAlt = Log_CTUN_BarAlt Else TempAlt = Log_GPS_Calculated_Alt
If Log_GPS_Spd < intVibrationSpeed And Log_In_Flight = frmMainForm.chkboxVibrationInFlight.Checked And TempAlt > intVibrationAltitude Then
If IMU_Vibration_Start_DL = 0 Then IMU_Vibration_Start_DL = DataLine

'Capture the Min and Max values from the IMU data if we are currently in slow flight, filter by increasing by half only each time.
If Log_IMU_AccX < Log_IMU_Min_AccX Then Log_IMU_Min_AccX = Log_IMU_Min_AccX - ((Log_IMU_Min_AccX - Log_IMU_AccX) / 2)
If Log_IMU_AccX > Log_IMU_Max_AccX Then Log_IMU_Max_AccX = Log_IMU_Max_AccX + ((Log_IMU_AccX - Log_IMU_Max_AccX) / 2)
If Log_IMU_AccY < Log_IMU_Min_AccY Then Log_IMU_Min_AccY = Log_IMU_Min_AccY - ((Log_IMU_Min_AccY - Log_IMU_AccY) / 2)
If Log_IMU_AccY > Log_IMU_Max_AccY Then Log_IMU_Max_AccY = Log_IMU_Max_AccY + ((Log_IMU_AccY - Log_IMU_Max_AccY) / 2)
If Log_IMU_AccZ < Log_IMU_Min_AccZ Then Log_IMU_Min_AccZ = Log_IMU_Min_AccZ - ((Log_IMU_Min_AccZ - Log_IMU_AccZ) / 2)
If Log_IMU_AccZ > Log_IMU_Max_AccZ Then Log_IMU_Max_AccZ = Log_IMU_Max_AccZ + ((Log_IMU_AccZ - Log_IMU_Max_AccZ) / 2)
If Log_GPS_Spd < log_IMU_Min_Spd Then log_IMU_Min_Spd = log_IMU_Min_Spd - ((log_IMU_Min_Spd - Log_GPS_Spd) / 2)
If Log_GPS_Spd > log_IMU_Max_Spd Then log_IMU_Max_Spd = log_IMU_Max_Spd + ((Log_GPS_Spd - log_IMU_Max_Spd) / 2)
If TempAlt < log_IMU_Min_Alt Then log_IMU_Min_Alt = TempAlt
If TempAlt > log_IMU_Max_Alt Then log_IMU_Max_Alt = TempAlt

'Debug.Print("GPS Spd: " & Log_GPS_Spd & " Max AccX: " & Log_IMU_Max_AccX & " Max AccY: " & Log_IMU_Max_AccY & " Max AccZ: " & Log_IMU_Max_AccZ)
'Debug.Print("CTUN Alt: " & Log_CTUN_BarAlt & " Min AccX: " & Log_IMU_Min_AccX & " Min AccY: " & Log_IMU_Min_AccY & " Min AccZ: " & Log_IMU_Min_AccZ)

'Collect the data for the slow flight averages.
Log_IMU_Sum_AccX = Log_IMU_Sum_AccX + Log_IMU_AccX
Log_IMU_Sum_AccY = Log_IMU_Sum_AccY + Log_IMU_AccY
Log_IMU_Sum_AccZ = Log_IMU_Sum_AccZ + Log_IMU_AccZ
log_IMU_Sum_Spd = log_IMU_Sum_Spd + Log_GPS_Spd
log_IMU_Sum_Alt = log_IMU_Sum_Alt + TempAlt


'### NEW CODE to send data directly to chart ####
frmMainForm.chartVibrations.Series("AccX").Points.AddY(Log_IMU_AccX)
frmMainForm.chartVibrations.Series("AccY").Points.AddY(Log_IMU_AccY)
frmMainForm.chartVibrations.Series("AccZ").Points.AddY(Log_IMU_AccZ)
frmMainForm.chartVibrations.Series("Altitude").Points.AddY(TempAlt) 'Log_CTUN_BarAlt
frmMainForm.chartVibrations.Series("Speed").Points.AddY(Log_GPS_Spd)

' 'Add the Marker Lines
frmMainForm.chartVibrations.Series("XYHighLine").Points.AddY(3)
frmMainForm.chartVibrations.Series("XYLowLine").Points.AddY(-3)
frmMainForm.chartVibrations.Series("ZHighLine").Points.AddY(-5)
frmMainForm.chartVibrations.Series("ZLowLine").Points.AddY(-15)

Log_IMU_DLs_for_Slow_FLight = Log_IMU_DLs_for_Slow_FLight + 1
IMU_Vibration_End_DL = DataLine


IMU_Vibration_Check = True
Else

'### NEW CODE to send data directly to chart ####
frmMainForm.chartVibrations.Series("AccX").Points.AddY(0)
frmMainForm.chartVibrations.Series("AccY").Points.AddY(0)
frmMainForm.chartVibrations.Series("AccZ").Points.AddY(0)
frmMainForm.chartVibrations.Series("Altitude").Points.AddY(TempAlt) 'Log_CTUN_BarAlt
frmMainForm.chartVibrations.Series("Speed").Points.AddY(Log_GPS_Spd)

' 'Add the Marker Lines
frmMainForm.chartVibrations.Series("XYHighLine").Points.AddY(3)
frmMainForm.chartVibrations.Series("XYLowLine").Points.AddY(-3)
frmMainForm.chartVibrations.Series("ZHighLine").Points.AddY(-5)
frmMainForm.chartVibrations.Series("ZLowLine").Points.AddY(-15)

Log_IMU_DLs_for_Slow_FLight = Log_IMU_DLs_for_Slow_FLight + 1
IMU_Vibration_End_DL = DataLine

End If
End If
'Are we in flight and either hovering or flying very slow above 3 meters? (Log_GPS_Spd in m/s)
Dim TempAlt As Single = 0
'set the Vibration variables based on the form Vibration Variables.
Dim intVibrationSpeed As Integer
Dim intVibrationAltitude As Integer
If IsNumeric(frmMainForm.txtVibrationSpeed.Text) = True Then
intVibrationSpeed = Val(frmMainForm.txtVibrationSpeed.Text)
Else
intVibrationSpeed = 1
End If
If IsNumeric(frmMainForm.txtVibrationAltitude.Text) = True Then
intVibrationAltitude = Val(frmMainForm.txtVibrationAltitude.Text)
Else
intVibrationAltitude = 3
End If

If CTUN_Logging = True Then TempAlt = Log_CTUN_BarAlt Else TempAlt = Log_GPS_Calculated_Alt
If Log_GPS_Spd < intVibrationSpeed And Log_In_Flight = frmMainForm.chkboxVibrationInFlight.Checked And TempAlt > intVibrationAltitude Then
If IMU_Vibration_Start_DL = 0 Then IMU_Vibration_Start_DL = DataLine

'Capture the Min and Max values from the IMU data if we are currently in slow flight, filter by increasing by half only each time.
If Log_IMU_AccX < Log_IMU_Min_AccX Then Log_IMU_Min_AccX = Log_IMU_Min_AccX - ((Log_IMU_Min_AccX - Log_IMU_AccX) / 2)
If Log_IMU_AccX > Log_IMU_Max_AccX Then Log_IMU_Max_AccX = Log_IMU_Max_AccX + ((Log_IMU_AccX - Log_IMU_Max_AccX) / 2)
If Log_IMU_AccY < Log_IMU_Min_AccY Then Log_IMU_Min_AccY = Log_IMU_Min_AccY - ((Log_IMU_Min_AccY - Log_IMU_AccY) / 2)
If Log_IMU_AccY > Log_IMU_Max_AccY Then Log_IMU_Max_AccY = Log_IMU_Max_AccY + ((Log_IMU_AccY - Log_IMU_Max_AccY) / 2)
If Log_IMU_AccZ < Log_IMU_Min_AccZ Then Log_IMU_Min_AccZ = Log_IMU_Min_AccZ - ((Log_IMU_Min_AccZ - Log_IMU_AccZ) / 2)
If Log_IMU_AccZ > Log_IMU_Max_AccZ Then Log_IMU_Max_AccZ = Log_IMU_Max_AccZ + ((Log_IMU_AccZ - Log_IMU_Max_AccZ) / 2)
If Log_GPS_Spd < log_IMU_Min_Spd Then log_IMU_Min_Spd = log_IMU_Min_Spd - ((log_IMU_Min_Spd - Log_GPS_Spd) / 2)
If Log_GPS_Spd > log_IMU_Max_Spd Then log_IMU_Max_Spd = log_IMU_Max_Spd + ((Log_GPS_Spd - log_IMU_Max_Spd) / 2)
If TempAlt < log_IMU_Min_Alt Then log_IMU_Min_Alt = TempAlt
If TempAlt > log_IMU_Max_Alt Then log_IMU_Max_Alt = TempAlt

'Debug.Print("GPS Spd: " & Log_GPS_Spd & " Max AccX: " & Log_IMU_Max_AccX & " Max AccY: " & Log_IMU_Max_AccY & " Max AccZ: " & Log_IMU_Max_AccZ)
'Debug.Print("CTUN Alt: " & Log_CTUN_BarAlt & " Min AccX: " & Log_IMU_Min_AccX & " Min AccY: " & Log_IMU_Min_AccY & " Min AccZ: " & Log_IMU_Min_AccZ)

'Collect the data for the slow flight averages.
Log_IMU_Sum_AccX = Log_IMU_Sum_AccX + Log_IMU_AccX
Log_IMU_Sum_AccY = Log_IMU_Sum_AccY + Log_IMU_AccY
Log_IMU_Sum_AccZ = Log_IMU_Sum_AccZ + Log_IMU_AccZ
log_IMU_Sum_Spd = log_IMU_Sum_Spd + Log_GPS_Spd
log_IMU_Sum_Alt = log_IMU_Sum_Alt + TempAlt


'### NEW CODE to send data directly to chart ####
frmMainForm.chartVibrations.Series("AccX").Points.AddY(Log_IMU_AccX)
frmMainForm.chartVibrations.Series("AccY").Points.AddY(Log_IMU_AccY)
frmMainForm.chartVibrations.Series("AccZ").Points.AddY(Log_IMU_AccZ)
frmMainForm.chartVibrations.Series("Altitude").Points.AddY(TempAlt) 'Log_CTUN_BarAlt
frmMainForm.chartVibrations.Series("Speed").Points.AddY(Log_GPS_Spd)

' 'Add the Marker Lines
frmMainForm.chartVibrations.Series("XYHighLine").Points.AddY(3)
frmMainForm.chartVibrations.Series("XYLowLine").Points.AddY(-3)
frmMainForm.chartVibrations.Series("ZHighLine").Points.AddY(-5)
frmMainForm.chartVibrations.Series("ZLowLine").Points.AddY(-15)

Log_IMU_DLs_for_Slow_FLight = Log_IMU_DLs_for_Slow_FLight + 1
IMU_Vibration_End_DL = DataLine


IMU_Vibration_Check = True
Else

'### NEW CODE to send data directly to chart ####
frmMainForm.chartVibrations.Series("AccX").Points.AddY(0)
frmMainForm.chartVibrations.Series("AccY").Points.AddY(0)
frmMainForm.chartVibrations.Series("AccZ").Points.AddY(0)
frmMainForm.chartVibrations.Series("Altitude").Points.AddY(TempAlt) 'Log_CTUN_BarAlt
frmMainForm.chartVibrations.Series("Speed").Points.AddY(Log_GPS_Spd)

' 'Add the Marker Lines
frmMainForm.chartVibrations.Series("XYHighLine").Points.AddY(3)
frmMainForm.chartVibrations.Series("XYLowLine").Points.AddY(-3)
frmMainForm.chartVibrations.Series("ZHighLine").Points.AddY(-5)
frmMainForm.chartVibrations.Series("ZLowLine").Points.AddY(-15)

Log_IMU_DLs_for_Slow_FLight = Log_IMU_DLs_for_Slow_FLight + 1
IMU_Vibration_End_DL = DataLine

End If
End If

Expand Down
29 changes: 29 additions & 0 deletions AMP Log Analiser x1/Classes/modIMU_Checks_v3_1_v3_2.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Module modIMU_Checks_v3_1_v3_2

Public Sub IMU_Checks_v3_1_v3_2()

'This part only check the correct data structure of the data line
'and prepares the variables ready for the MainAnalysis which
'is called directly after by this code.

' THIS CODE MUST ONLY BE CALLED AFTER THE DATA LINE HAS BEEN VALIDATED AS THE CORRECT TYPE !!!

'An IMU value should have only 7 pieces of numeric data!

'FMT, 131, 31, IMU, Iffffff, TimeMS,GyrX,GyrY,GyrZ,AccX,AccY,AccZ

If ReadFileResilienceCheck(7) = True Then
'Debug.Print("IMU Data Detected...")
Log_IMU_TimeMS = Val(DataArray(1))
Log_IMU_GyrX = Val(DataArray(2))
Log_IMU_GyrY = Val(DataArray(3))
Log_IMU_GyrZ = Val(DataArray(4))
Log_IMU_AccX = Val(DataArray(5))
Log_IMU_AccY = Val(DataArray(6))
Log_IMU_AccZ = Val(DataArray(7))
Call IMU_MainAnalysis()
End If

End Sub

End Module
30 changes: 30 additions & 0 deletions AMP Log Analiser x1/Classes/modIMU_Checks_v3_3.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Module modIMU_Checks_v3_3

Public Sub IMU_Checks_v3_3()

'This part only check the correct data structure of the data line
'and prepares the variables ready for the MainAnalysis which
'is called directly after by this code.

' THIS CODE MUST ONLY BE CALLED AFTER THE DATA LINE HAS BEEN VALIDATED AS THE CORRECT TYPE !!!

' v3.2 FMT, 131, 31, IMU, Iffffff, TimeMS, GyrX, GyrY, GyrZ, AccX, AccY, AccZ
' v3.3 FMT, 131, 43, IMU, IffffffIIf, TimeMS, GyrX, GyrY, GyrZ, AccX, AccY, AccZ, ErrG, ErrA, Temp

'An IMU value should have only 10 pieces of numeric data!

If ReadFileResilienceCheck(10) = True Then
'Debug.Print("IMU Data Detected...")
Log_IMU_TimeMS = Val(DataArray(1))
Log_IMU_GyrX = Val(DataArray(2))
Log_IMU_GyrY = Val(DataArray(3))
Log_IMU_GyrZ = Val(DataArray(4))
Log_IMU_AccX = Val(DataArray(5))
Log_IMU_AccY = Val(DataArray(6))
Log_IMU_AccZ = Val(DataArray(7))
Call IMU_MainAnalysis()
End If

End Sub

End Module
9 changes: 8 additions & 1 deletion AMP Log Analiser x1/Classes/modMainReadFile.vb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,14 @@ Module modMainReadFile
Call GPS_Checks()

'IMU Checks - Vibration
Call IMU_Checks()
If DataArray(0) = "IMU" Then
If ReadFileVersion = 3.1 Or ReadFileVersion = 3.2 Then
Call IMU_Checks_v3_1_v3_2()
Else
Call IMU_Checks_v3_3()
End If
End If


'NTUN Checks, Navigation Data - MUST CALL BEFORE ATT due to Charting Data
If DataArray(0) = "NTUN" Then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ C:\Users\Kevin\Documents\GitHub\APM_Log_File_Analyzer\AMP Log Analiser x1\bin\De
C:\Users\Kevin\Documents\GitHub\APM_Log_File_Analyzer\AMP Log Analiser x1\bin\Debug\Microsoft.WindowsAPICodePack.Shell.pdb
C:\Users\Kevin\Documents\GitHub\APM_Log_File_Analyzer\AMP Log Analiser x1\bin\Debug\Microsoft.WindowsAPICodePack.Shell.xml
C:\Users\Kevin\Documents\GitHub\APM_Log_File_Analyzer\AMP Log Analiser x1\bin\Debug\Microsoft.WindowsAPICodePack.ShellExtensions.pdb
C:\Users\Kevin\Documents\GitHub\APM_Log_File_Analyzer\AMP Log Analiser x1\obj\Debug\AMP Log Analiser x1.vbprojResolveAssemblyReference.cache
C:\Users\Kevin\Documents\GitHub\APM_Log_File_Analyzer\AMP Log Analiser x1\obj\Debug\APMLogFileAnaliser.frmMainForm.resources
C:\Users\Kevin\Documents\GitHub\APM_Log_File_Analyzer\AMP Log Analiser x1\obj\Debug\APMLogFileAnaliser.frmUpdate.resources
C:\Users\Kevin\Documents\GitHub\APM_Log_File_Analyzer\AMP Log Analiser x1\obj\Debug\APMLogFileAnaliser.frmParameters.resources
Expand All @@ -82,4 +83,3 @@ C:\Users\Kevin\Documents\GitHub\APM_Log_File_Analyzer\AMP Log Analiser x1\obj\De
C:\Users\Kevin\Documents\GitHub\APM_Log_File_Analyzer\AMP Log Analiser x1\obj\Debug\APM Log File Analiser.exe
C:\Users\Kevin\Documents\GitHub\APM_Log_File_Analyzer\AMP Log Analiser x1\obj\Debug\APM Log File Analiser.xml
C:\Users\Kevin\Documents\GitHub\APM_Log_File_Analyzer\AMP Log Analiser x1\obj\Debug\APM Log File Analiser.pdb
C:\Users\Kevin\Documents\GitHub\APM_Log_File_Analyzer\AMP Log Analiser x1\obj\Debug\AMP Log Analiser x1.vbprojResolveAssemblyReference.cache