-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnorthrop_grumman_exporter.py
More file actions
50 lines (50 loc) · 1.67 KB
/
Copy pathnorthrop_grumman_exporter.py
File metadata and controls
50 lines (50 loc) · 1.67 KB
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
import multiprocessing as mp
import struct
import time
import numba
from numba import njit
try:
import cupy as xp
HAS_GPU = True
except ImportError:
import numpy as xp
HAS_GPU = False
print("CPU Fallback: Standard Vectorization Active (Performance)")
class NorthropGrummanExporter:
"""
Serializes telemetry into Open Mission Systems (OMS) compliant
binary structures for mission-critical flight management.
"""
PACKET_FORMAT = ">H H d 16f"
SYNC_WORD = 0xABCD # Northrop specific mission sync word
@staticmethod
@njit(fastmath=True)
def normalize_sensor_data(data_array):
return data_array.astype(np.float32)
@njit(fastmath=True)
def dispatch(self, payload, output_dir):
data = [
payload.get('temp_c', 0.0),
payload.get('pressure_hpa', 0.0),
payload.get('lat', 0.0),
payload.get('lon', 0.0),
payload.get('alt', 0.0),
payload.get('pitch', 0.0),
payload.get('roll', 0.0),
payload.get('yaw', 0.0),
payload.get('ground_speed', 0.0),
payload.get('climb_rate', 0.0),
payload.get('heading', 0.0),
payload.get('throttle', 0.0),
*[0.0]*4 # Reserved space for future mission-specific sensors
]
packet = struct.pack(
self.PACKET_FORMAT,
self.SYNC_WORD,
0x0001, # Message Type (1 = Nav/Flight State)
time.time(),
*data
)
with open(f"{output_dir}/northrop_oms_bus.bin", "ab") as f:
f.write(packet)
print(f"Northrop Grumman OMS Bus Frame Dispatched: {len(packet)} bytes")