Skip to content

Commit 9b0f2e5

Browse files
1BlademasterCopilotKwash67
authored
841 convert log bin files (#842)
* Start adding functionality to parse dataflash bin files * Update units data output for dataflash log files * Create shared fla types file * Tidy up types * Add data transformations for dataflash bin files * Edit dataflash parser to parse all log messages * Fix ignored messages * Remove debug file saving and console log * Convert utils file to typescript, update tsconfig to ignore javascript type declarions not being found * Address copilot review comments * Fix eslint dataflash parser errors * Add aircraft type parsing * Fix types for aircraft type function * Update gcs/electron/utils/dataflashParser.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Address copilot review comments * Fix preset categories * Fix time since boot not converting correctly * Fix flight modes colouring * Normalise message names and add GPS time conversion * Fix message filter descriptions * Address copilot review comments * set yAxisID to UNKNOWN if missing --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Kwashie A <104215256+Kwash67@users.noreply.github.com>
1 parent 03bb7a8 commit 9b0f2e5

11 files changed

Lines changed: 1692 additions & 244 deletions

File tree

gcs/electron/fla.ts

Lines changed: 166 additions & 112 deletions
Large diffs are not rendered by default.

gcs/electron/types/flaTypes.ts

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
// Shared types for FLA (Falcon Log Analyser)
2+
3+
// The other keys depend on the message type and they represent the individual
4+
// fields of the message.
5+
export interface MessageObject {
6+
name: string // e.g., "XKY1"
7+
TimeUS?: number // e.g., 1274721512
8+
Instance?: number
9+
Inst?: number
10+
[key: string]: string | number | undefined
11+
}
12+
13+
// Format messages
14+
export interface FormatMessage {
15+
name: string // e.g., "CTUN"
16+
type?: number // e.g., 0
17+
format: string // e.g., "QccccffffBffi"
18+
fields: string[] // e.g., ["TimeUS", "Roll", "Pitch", "RdO", "As", "SAs", "GU"]
19+
units?: string | string[] // e.g., "sdddd---n-n-n" or ["s", "deg", "deg", "deg", "deg", "UNKNOWN", ...]
20+
multipliers?: string | string[] // e.g., "FBBBB---000-B" or ["F", "B", "B", "B", "B", "UNKNOWN", ...]
21+
}
22+
23+
// Dict with message name as key and array of message objects as value
24+
// Other keys are format, units and aircraftType for log metadata
25+
export interface LoadedLogMessages {
26+
[messageName: string]:
27+
| MessageObject[]
28+
| { [key: string]: FormatMessage }
29+
| { [key: string]: string }
30+
| string
31+
| null
32+
}
33+
34+
// Dict with message name as key and array of message objects as value
35+
// Other keys are format, units and aircraftType for log metadata
36+
// Units are a mapping from single character to SI unit, e.g. { "k": "deg/s/s"}
37+
// AircraftType is a string like "copter", "plane", "quadplane" or null
38+
export interface Messages {
39+
// Metadata properties
40+
format: { [key: string]: FormatMessage }
41+
aircraftType: AircraftType
42+
43+
// Message data - use index signature for dynamic message types
44+
[messageName: string]:
45+
| MessageObject[] // For dynamic message types like "CTUN", "ATT", etc.
46+
| { [key: string]: FormatMessage } // For the "format" property
47+
| AircraftType // For the "aircraftType" property
48+
}
49+
50+
export type AircraftType = "copter" | "plane" | "quadplane" | null
51+
52+
export interface FilterState {
53+
[messageName: string]: { [fieldName: string]: boolean }
54+
}
55+
56+
export interface FieldStats {
57+
min: number
58+
max: number
59+
sum: number
60+
count: number
61+
}
62+
63+
export interface MeanValues {
64+
[fieldKey: string]: {
65+
mean: string
66+
max: string
67+
min: string
68+
}
69+
}
70+
71+
export interface ExpandResult {
72+
updatedMessages: LoadedLogMessages
73+
updatedFilters: FilterState
74+
updatedFormats: { [key: string]: FormatMessage }
75+
}
76+
77+
export interface ParseResult {
78+
success: boolean
79+
error?: string
80+
summary?: LogSummary
81+
}
82+
83+
export interface LogSummary {
84+
formatMessages: { [key: string]: FormatMessage }
85+
utcAvailable: boolean
86+
logEvents: MessageObject[]
87+
flightModeMessages: MessageObject[]
88+
logType: string
89+
messageFilters: Record<string, unknown>
90+
messageMeans: Record<
91+
string,
92+
{ mean: string; max: string; min: string }
93+
> | null
94+
aircraftType: AircraftType
95+
}
96+
97+
export interface Dataset {
98+
label: string
99+
yAxisID: string
100+
x: Float64Array
101+
y: Float32Array
102+
}
103+
104+
export type LogType =
105+
| "dataflash_bin"
106+
| "dataflash_log"
107+
| "fgcs_telemetry"
108+
| "mp_telemetry"
109+
| null

0 commit comments

Comments
 (0)