-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathf1_telemetry_rig.py
More file actions
67 lines (52 loc) · 2 KB
/
Copy pathf1_telemetry_rig.py
File metadata and controls
67 lines (52 loc) · 2 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import requests
import time
import math
import random
import json
# ⚠️ REPLACE THIS WITH YOUR WEBTRIGGER URL
WEBHOOK_URL = "https://c7104b49-0a91-46dc-b2c6-de1b156b9b96.hello.atlassian-dev.net/x1/tkzYBpzjL0lYSzz4p7uWA2lXyoU"
def generate_telemetry(step):
base_vibration = 50.0
CRASH_START_FRAME = 15
# 1. NORMAL PHASE
if step < CRASH_START_FRAME:
# smooth sine wave + tiny noise
noise = random.uniform(-0.5, 0.5)
vibration = base_vibration + math.sin(step * 0.2) * 1.5 + noise
# 2. THE CRASH
else:
print("⚠️ INJECTING ANOMALY...")
crash_intensity = min((step - CRASH_START_FRAME) * 2.0, 45.0)
vibration = base_vibration + crash_intensity + random.uniform(-1.0, 1.0)
# 3. OTHER SENSORS
temperature = 85.0 + (step * 0.05) # Heat builds up
aero_load = 1500.0 + math.sin(step * 0.1) * 10.0
return {
"vibration": vibration,
"temperature": temperature,
"aero_load": aero_load,
"timestamp": time.time()
}
def main():
print(f"🏎️ Starting F1 Telemetry Rig...")
print(f"📡 Target: {WEBHOOK_URL}")
print(f"⏱️ Crash scheduled for T-minus 7.5 seconds (Frame 15)...")
print("------------------------------------------------")
step = 0
try:
while True:
data = generate_telemetry(step)
try:
# Send Data to Atlassian
response = requests.post(WEBHOOK_URL, json=data)
# Visual Log
status = "✅" if response.status_code == 200 else "❌"
print(f"Frame {step}: Vib={data['vibration']:.2f}Hz -> {response.status_code} {status}")
except Exception as e:
print(f"Frame {step}: ❌ Connection Error: {e}")
step += 1
time.sleep(0.5) # Send every 500ms
except KeyboardInterrupt:
print("\n🛑 Telemetry Rig Stopped.")
if __name__ == "__main__":
main()