-
Notifications
You must be signed in to change notification settings - Fork 1
/
ForzaHorizonTelemetry.py
769 lines (580 loc) · 19.9 KB
/
ForzaHorizonTelemetry.py
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
# ####################################################################################
# ____ _ ____ _
# / ___| __ _ _ __ | |_ / ___(_)_ __ _____ ____ _
# \___ \ / _` | '_ \| __| | | | '_ \ / _ \ \ / / _` |
# ___) | (_| | | | | |_| |___| | | | | __/\ V / (_| |
# |____/ \__,_|_| |_|\__|\____|_|_| |_|\___| \_/ \__,_|
#
######################################################################################
import struct
import math
# These below are the Byte indexes, written in order
RaceOn = 0
TimeStamp = 4
MaxRPM = 8
IdleRPM = 12
CurrentRPM = 16
AccelerationX = 20
AccelerationY = 24
AccelerationZ = 28
VelocityX = 32
VelocityY = 36
VelocityZ = 40
AngularVelocityX = 44
AngularVelocityY = 48
AngularVelocityZ = 52
Yaw = 56
Pitch = 60
Roll = 64
NormalizedSuspensionTravelFL = 68
NormalizedSuspensionTravelFR = 72
NormalizedSuspensionTravelRL = 76
NormalizedSuspensionTravelRR = 80
TireSlipRatioFL = 84
TireSlipRatioFR = 88
TireSlipRatioRL = 92
TireSlipRatioRR = 96
WheelRotationSpeedFL = 100
WheelRotationSpeedFR = 104
WheelRotationSpeedRL = 108
WheelRotationSpeedRR = 112
WheelOnRumbleStripFL = 116
WheelOnRumbleStripFR = 120
WheelOnRumbleStripRL = 124
WheelOnRumbleStripRR = 128
WheelInPuddleDepthFL = 132
WheelInPuddleDepthFR = 136
WheelInPuddleDepthRL = 140
WheelInPuddleDepthRR = 144
SurfaceRumbleFrontLeft = 148
SurfaceRumbleFrontRight = 152
SurfaceRumbleRearLeft = 156
SurfaceRumbleRearRight = 160
TireSlipAngleFL = 164
TireSlipAngleFR = 168
TireSlipAngleRL = 172
TireSlipAngleRR = 176
TireCombinedSlipFL = 180
TireCombinedSlipFR = 184
TireCombinedSlipRL = 188
TireCombinedSlipRR = 192
SuspensionTravelMetersFL = 196
SuspensionTravelMetersFR = 200
SuspensionTravelMetersRL = 204
SuspensionTravelMetersRR = 208
CarClass = 216
CarPerformanceIndex = 220
DrivetrainType = 224
NumberOfCylinders = 228
CarType = 232
ObjectHit = 236
# Byte unknown
# Byte unknown
# Byte unknown
# Byte unknown
# Byte unknown
# Byte unknown
Ordinal = 240
PositionX = 244
PositionY = 248
PositionZ = 252
Speed = 256
Power = 260
Torque = 264
TireTempFL = 268
TireTempFR = 272
TireTempRL = 276
TireTempRR = 280
Boost = 284
Fuel = 288
DistanceTraveled = 292
BestLap = 296
LastLap = 300
CurrentLap = 304
CurrentRaceTime = 308
LapNumber = 312
RacePosition = 314
Throttle = 315
Brake = 316
Clutch = 317
HandBrake = 318
Gear = 319
Steer = 320
NormalizedDrivingLine = 321
NormalizedAIBrakeDifference = 322
# Variables for timer function
t1 = 0
t2 = 0
def get_race_on(DataBytes):
variants = {
0: 'OFF',
1: 'ON',
}
try:
race_on = struct.unpack('<H', DataBytes[RaceOn : RaceOn + 2])
return variants.get(race_on[0])
except:
return("Error calling: get_race_on")
def get_time_stamp(DataBytes):
try:
time_stamp = struct.unpack('<l', DataBytes[TimeStamp : TimeStamp + 4])
return time_stamp[0]
except:
return("Error calling: get_time_stamp")
def get_max_rpm(DataBytes):
try:
max_rpm = struct.unpack('<f', DataBytes[MaxRPM : MaxRPM + 4])
return int(max_rpm[0])
except:
return("Error calling: get_max_rpm")
def get_idle_rpm(DataBytes):
try:
IDLE_rpm = struct.unpack('<f', DataBytes[IdleRPM : IdleRPM + 4])
return int(IDLE_rpm[0])
except:
return("Error calling: get_idle_rpm")
def get_rpm(DataBytes):
try:
turatia = struct.unpack('<f', DataBytes[CurrentRPM : CurrentRPM + 4])
return int(turatia[0])
except:
return("Error calling: get_rpm")
def get_AccelX(DataBytes):
try:
accelX = struct.unpack('<f', DataBytes[AccelerationX : AccelerationX + 4])
return accelX[0] / 9.81
except:
return("Error calling: get_AccelX")
def get_AccelY(DataBytes):
try:
accelY = struct.unpack('<f', DataBytes[AccelerationY : AccelerationY + 4])
return accelY[0] / 9.81
except:
return("Error calling: get_AccelY")
def get_AccelZ(DataBytes):
try:
accelZ = struct.unpack('<f', DataBytes[AccelerationZ : AccelerationZ + 4])
return accelZ[0] / 9.81
except:
return("Error calling: get_AccelZ")
def get_Rez_Accel(DataBytes):
ax = get_AccelX(DataBytes)
ay = get_AccelY(DataBytes)
az = get_AccelZ(DataBytes)
return math.sqrt(ax**2 + ay**2 + az**2)
def get_VelocityX(DataBytes):
try:
VelX = struct.unpack('<f', DataBytes[VelocityX : VelocityX + 4])
return VelX[0] * 3.6
except:
return("Error calling: get_VelocityX")
def get_VelocityY(DataBytes):
try:
VelY = struct.unpack('<f', DataBytes[VelocityY : VelocityY + 4])
return VelY[0] * 3.6
except:
return("Error calling: get_VelocityY")
def get_VelocityZ(DataBytes):
try:
VelZ = struct.unpack('<f', DataBytes[VelocityZ : VelocityZ + 4])
return VelZ[0] * 3.6
except:
return("Error calling: get_VelocityZ")
def get_angular_VelocityX(DataBytes):
try:
AngVelX = struct.unpack('<f', DataBytes[AngularVelocityX : AngularVelocityX + 4])
return AngVelX[0]
except:
return("Error calling: get_angular_VelocityX")
def get_angular_VelocityY(DataBytes):
try:
AngVelY = struct.unpack('<f', DataBytes[AngularVelocityY : AngularVelocityY + 4])
return AngVelY[0]
except:
return("Error calling: get_angular_VelocityY")
def get_angular_VelocityZ(DataBytes):
try:
AngVelZ = struct.unpack('<f', DataBytes[AngularVelocityZ : AngularVelocityZ + 4])
return AngVelZ[0]
except:
return("Error calling: get_angular_VelocityZ")
def get_Yaw(DataBytes):
try:
yaw = struct.unpack('<f', DataBytes[Yaw : Yaw + 4])
return yaw[0] * 100
except:
return("Error calling: get_Yaw")
def get_Pitch(DataBytes):
try:
pitch = struct.unpack('<f', DataBytes[Pitch : Pitch + 4])
return pitch[0] * 100
except:
return("Error calling: get_Pitch")
def get_Roll(DataBytes):
try:
roll = struct.unpack('<f', DataBytes[Roll : Roll + 4])
return roll[0] * 100
except:
return("Error calling: get_Roll")
def get_normalized_suspension_travel_FL(DataBytes):
try:
nstfl = struct.unpack('<f', DataBytes[NormalizedSuspensionTravelFL : NormalizedSuspensionTravelFL + 4])
return nstfl[0] * 100
except:
return("Error calling: get_normalized_suspension_travel_FL")
def get_normalized_suspension_travel_FR(DataBytes):
try:
nstfr = struct.unpack('<f', DataBytes[NormalizedSuspensionTravelFR : NormalizedSuspensionTravelFR + 4])
return nstfr[0] * 100
except:
return("Error calling: get_normalized_suspension_travel_FR")
def get_normalized_suspension_travel_RL(DataBytes):
try:
nstrl = struct.unpack('<f', DataBytes[NormalizedSuspensionTravelRL : NormalizedSuspensionTravelRL + 4])
return nstrl[0] * 100
except:
return("Error calling: get_normalized_suspension_travel_RL")
def get_normalized_suspension_travel_RR(DataBytes):
try:
nstrr = struct.unpack('<f', DataBytes[NormalizedSuspensionTravelRR : NormalizedSuspensionTravelRR + 4])
return nstrr[0] * 100
except:
return("Error calling: get_normalized_suspension_travel_RR")
def get_tire_slip_ratio_FL(DataBytes):
try:
tsrfl = struct.unpack('<f', DataBytes[TireSlipRatioFL : TireSlipRatioFL + 4])
return tsrfl[0] * 100
except:
return("Error calling: get_tire_slip_ratio_FL")
def get_tire_slip_ratio_FR(DataBytes):
try:
tsrfr = struct.unpack('<f', DataBytes[TireSlipRatioFR : TireSlipRatioFR + 4])
return tsrfr[0] * 100
except:
return("Error calling: get_tire_slip_ratio_FR")
def get_tire_slip_ratio_RL(DataBytes):
try:
tsrrl = struct.unpack('<f', DataBytes[TireSlipRatioRL : TireSlipRatioRL + 4])
return tsrrl[0] * 100
except:
return("Error calling: get_tire_slip_ratio_RL")
def get_tire_slip_ratio_RR(DataBytes):
try:
tsrrr = struct.unpack('<f', DataBytes[TireSlipRatioRR : TireSlipRatioRR + 4])
return tsrrr[0] * 100
except:
return("Error calling: get_tire_slip_ratio_RR")
def get_wheel_rot_Speed_FL(DataBytes):
try:
rsfl = struct.unpack('<f', DataBytes[WheelRotationSpeedFL : WheelRotationSpeedFL + 4])
return rsfl[0]
except:
return("Error calling: get_wheel_rot_Speed_FL")
def get_wheel_rot_Speed_FR(DataBytes):
try:
rsfr = struct.unpack('<f', DataBytes[WheelRotationSpeedFR : WheelRotationSpeedFR + 4])
return rsfr[0]
except:
return("Error calling: get_wheel_rot_Speed_FR")
def get_wheel_rot_Speed_RL(DataBytes):
try:
rsrl = struct.unpack('<f', DataBytes[WheelRotationSpeedRL : WheelRotationSpeedRL + 4])
return rsrl[0]
except:
return("Error calling: get_wheel_rot_Speed_RL")
def get_wheel_rot_Speed_RR(DataBytes):
try:
rsrr = struct.unpack('<f', DataBytes[WheelRotationSpeedRR : WheelRotationSpeedRR + 4])
return rsrr[0]
except:
return("Error calling: get_wheel_rot_Speed_RR")
def get_slip_angle_FL(DataBytes):
try:
tsfl = struct.unpack('<f', DataBytes[TireSlipAngleFL : TireSlipAngleFL + 4])
return tsfl[0]
except:
return("Error calling: get_slip_angle_FL")
def get_slip_angle_FR(DataBytes):
try:
tsfr = struct.unpack('<f', DataBytes[TireSlipAngleFR : TireSlipAngleFR + 4])
return tsfr[0]
except:
return("Error calling: get_slip_angle_FR")
def get_slip_angle_RL(DataBytes):
try:
tsrl = struct.unpack('<f', DataBytes[TireSlipAngleRL : TireSlipAngleRL + 4])
return tsrl[0]
except:
return("Error calling: get_slip_angle_RL")
def get_slip_angle_RR(DataBytes):
try:
tsrr = struct.unpack('<f', DataBytes[TireSlipAngleRR : TireSlipAngleRR + 4])
return tsrr[0]
except:
return("Error calling: get_slip_angle_RR")
def get_tire_combined_slip_FL(DataBytes):
try:
tcsfl = struct.unpack('<f', DataBytes[TireCombinedSlipFL : TireCombinedSlipFL + 4])
return tcsfl[0]
except:
return("Error calling: get_tire_combined_slip_FL")
def get_tire_combined_slip_FR(DataBytes):
try:
tcsfr = struct.unpack('<f', DataBytes[TireCombinedSlipFR : TireCombinedSlipFR + 4])
return tcsfr[0]
except:
return("Error calling: get_tire_combined_slip_FR")
def get_tire_combined_slip_RL(DataBytes):
try:
tcsrl = struct.unpack('<f', DataBytes[TireCombinedSlipRL : TireCombinedSlipRL + 4])
return tcsrl[0]
except:
return("Error calling: get_tire_combined_slip_RL")
def get_tire_combined_slip_RR(DataBytes):
try:
tcsrr = struct.unpack('<f', DataBytes[TireCombinedSlipRR : TireCombinedSlipRR + 4])
return tcsrr[0]
except:
return("Error calling: get_tire_combined_slip_RR")
def get_suspension_travel_FL(DataBytes):
try:
stfl = struct.unpack('<f', DataBytes[SuspensionTravelMetersFL : SuspensionTravelMetersFL + 4])
return stfl[0]
except:
return("Error calling: get_suspension_travel_FL")
def get_suspension_travel_FR(DataBytes):
try:
stfr = struct.unpack('<f', DataBytes[SuspensionTravelMetersFR : SuspensionTravelMetersFR + 4])
return stfr[0]
except:
return("Error calling: get_suspension_travel_FR")
def get_suspension_travel_RL(DataBytes):
try:
strl = struct.unpack('<f', DataBytes[SuspensionTravelMetersRL : SuspensionTravelMetersRL + 4])
return strl[0]
except:
return("Error calling: get_suspension_travel_RL")
def get_suspension_travel_RR(DataBytes):
try:
strr = struct.unpack('<f', DataBytes[SuspensionTravelMetersRR : SuspensionTravelMetersRR + 4])
return strr[0]
except:
return("Error calling: get_suspension_travel_RR")
def get_corresp_car_class(CCVal):
CarClassCases = {
0: "D",
1: "C",
2: "B",
3: "A",
4: "S1",
5: "S2",
6: "X",
}
return CarClassCases.get(CCVal, 'Not_found')
def get_car_class(DataBytes):
try:
Car_class = struct.unpack('<i', DataBytes[CarClass : CarClass + 4])
return get_corresp_car_class(Car_class[0])
except:
return("Error calling: get_car_class")
def get_performance_index(DataBytes):
try:
PerfIndex = struct.unpack('<i', DataBytes[CarPerformanceIndex : CarPerformanceIndex + 4])
return PerfIndex[0]
except:
return("Error calling: get_performance_index")
def get_corresp_drivetrain(DtVal):
DrivetrainCases = {
0: "FWD",
1: "RWD",
2: "AWD",
}
return DrivetrainCases.get(DtVal, 'Not_found')
def get_drivetrain_type(DataBytes):
try:
DType = struct.unpack('<i', DataBytes[DrivetrainType : DrivetrainType + 4])
return get_corresp_drivetrain(DType[0])
except:
return("Error calling: get_drivetrain_type")
def get_num_of_cyl(DataBytes):
try:
Num_cyl = struct.unpack('<i', DataBytes[NumberOfCylinders : NumberOfCylinders + 4])
return Num_cyl[0]
except:
return("Error calling: get_num_of_cyl")
def get_CoordX(DataBytes):
try:
CoordX = struct.unpack('<f', DataBytes[PositionX : PositionX + 4])
return CoordX[0]
except:
return("Error calling: get_CoordX")
def get_CoordY(DataBytes):
try:
CoordY = struct.unpack('<f', DataBytes[PositionY : PositionY + 4])
return CoordY[0]
except:
return("Error calling: get_CoordY")
def get_CoordZ(DataBytes):
try:
CoordZ = struct.unpack('<f', DataBytes[PositionZ : PositionZ + 4])
return CoordZ[0]
except:
return("Error calling: get_CoordZ")
def get_Speed(DataBytes):
try:
speed = struct.unpack('<f', DataBytes[Speed : Speed + 4])
return speed[0] * 3.6
except:
return("Error calling: get_Speed")
def get_Power(DataBytes):
try:
power = struct.unpack('<f', DataBytes[Power : Power + 4])
return power[0] * 0.00134102
except:
return("Error calling: get_Power")
def get_Torque(DataBytes):
try:
Tq = struct.unpack('<f', DataBytes[Torque : Torque + 4])
return Tq[0]
except:
return("Error calling: get_Torque")
def get_Tire_temp_FL(DataBytes):
try:
tire_temp_FL = struct.unpack('<f', DataBytes[TireTempFL : TireTempFL + 4])
return (tire_temp_FL[0] - 32) * (5/9)
except:
return("Error calling: get_Tire_temp_FL")
def get_Tire_temp_FR(DataBytes):
try:
tire_temp_FR = struct.unpack('<f', DataBytes[TireTempFR : TireTempFR + 4])
return (tire_temp_FR[0] - 32) * (5/9)
except:
return("Error calling: get_Tire_temp_FR")
def get_Tire_temp_RL(DataBytes):
try:
tire_temp_RL = struct.unpack('<f', DataBytes[TireTempRL : TireTempRL + 4])
return (tire_temp_RL[0] - 32) * (5/9)
except:
return("Error calling: get_Tire_temp_RL")
def get_Tire_temp_RR(DataBytes):
try:
tire_temp_RR = struct.unpack('<f', DataBytes[TireTempRR : TireTempRR + 4])
return (tire_temp_RR[0] - 32) * (5/9)
except:
return("Error calling: get_Tire_temp_RR")
def get_Boost(DataBytes):
try:
boost = struct.unpack('<f', DataBytes[Boost : Boost + 4])
return round(boost[0] * 0.0689475729, 3)
except:
return("Error calling: get_Boost")
def get_Fuel(DataBytes):
try:
fuel = struct.unpack('<h', DataBytes[Fuel : Fuel + 4])
return fuel[0]
except:
return("Error calling: get_Fuel")
def get_distance_traveled(DataBytes):
try:
Dist = struct.unpack('<h', DataBytes[DistanceTraveled : DistanceTraveled + 4])
return Dist[0]
except:
return("Error calling: get_distance_traveled")
def get_best_lap(DataBytes):
try:
BestLap = struct.unpack('<h', DataBytes[BestLap : BestLap + 4])
return BestLap[0]
except:
return("Error calling: get_best_lap")
def get_last_lap(DataBytes):
try:
LastLap = struct.unpack('<h', DataBytes[LastLap : LastLap + 4])
return LastLap[0]
except:
return("Error calling: get_last_lap")
def get_current_lap(DataBytes):
try:
CurrentLap_ = struct.unpack('<h', DataBytes[CurrentLap : CurrentLap + 4])
return CurrentLap_[0]
except:
return("Error calling: get_current_lap")
def get_current_race_time(DataBytes):
try:
RaceTime = struct.unpack('<h', DataBytes[CurrentRaceTime : CurrentRaceTime + 4])
return RaceTime[0]
except:
return("Error calling: get_current_race_time")
def get_lap_number(DataBytes):
try:
LapNum = struct.unpack('<h', DataBytes[LapNumber : LapNumber + 2])
return LapNum[0]
except:
return("Error calling: get_lap_number")
def get_race_position(DataBytes):
try:
RacePos = DataBytes[RacePosition]
return RacePos
except:
return("Error calling: get_race_position")
def get_Throttle_status(DataBytes):
try:
Throttle_status = DataBytes[Throttle]
return Throttle_status * 100 / 255
except:
return("Error calling: get_Throttle_status")
def get_Brake_status(DataBytes):
try:
Brake_status = DataBytes[Brake]
return Brake_status * 100 / 255
except:
return("Error calling: get_Brake_status")
def get_Clutch_status(DataBytes):
try:
Clutch_status = DataBytes[Clutch]
return Clutch_status * 100 / 255
except:
return("Error calling: get_Clutch_status")
def get_HandBrake_status(DataBytes):
try:
HandBrake_stat = DataBytes[HandBrake]
HandBrake_stat = HandBrake_stat * 100 / 255
if HandBrake_stat > 0:
return 'Active'
else:
return 'NotActive'
except:
return("Error calling: get_HandBrake_status")
def get_Gear(DataBytes):
try:
gear = DataBytes[Gear]
return gear
except:
return("Error calling: get_Gear")
def get_Steering_input(DataBytes):
try:
Steering_input = DataBytes[Steer]
return Steering_input * 100 / 127
except:
return("Error calling: get_Steering_input")
def get_norm_driving_line(DataBytes):
try:
driving_line = DataBytes[NormalizedDrivingLine]
return driving_line
except:
return("Error calling: get_norm_driving_line")
def get_norm_AI_brake_diff(DataBytes):
try:
brake_diff = DataBytes[NormalizedAIBrakeDifference]
return brake_diff
except:
return("Error calling: get_norm_AI_brake_diff")
def timer(DataBytes, FinalSpeed):
if(int(round(get_Speed(DataBytes))) <= 1 and get_HandBrake_status(DataBytes) == 'Active'):
global t1
t1 = int(get_time_stamp(DataBytes))
print(f"T1 has been assigned to: {t1}")
if(FinalSpeed == int(round(get_Speed(DataBytes)))):
global t2
t2 = int(get_time_stamp(DataBytes))
print(f"T2 has been assigned to: {t2}")
return (t2 - t1) / 1000