Last active
November 18, 2022 08:09
-
-
Save himynamesdave/ca819516d4dad7b96d602d0531945227 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct | |
# header | |
reserved = struct.pack('<H', 0) | |
camm_case = struct.pack('<H', 6) | |
header = (reserved+camm_case) | |
# sample 0 | |
time_gps_epoch_0 = struct.pack('<d', 1553343930000.0) | |
gps_fix_type_0 = struct.pack('<i', 3) | |
latitude_0 = struct.pack('<d', 51.26006666666667) | |
longitude_0 = struct.pack('<d', -0.9531388888888889) | |
altitude_0 = struct.pack('<f', 127.7) | |
horizontal_accuracy_0 = struct.pack('<f', 1.0) | |
vertical_accuracy_0 = struct.pack('<f', 1.0) | |
velocity_east_0 = struct.pack('<f', -0.42552019866750024) | |
velocity_north_0 = struct.pack('<f', 0.2466133528597531) | |
velocity_up_0 = struct.pack('<f', 0.0) | |
speed_accuracy_0 = struct.pack('<f', 0.0) | |
sample_0_no_head = (time_gps_epoch_0+gps_fix_type_0+latitude_0+ | |
longitude_0+altitude_0+horizontal_accuracy_0+vertical_accuracy_0+ | |
velocity_east_0+velocity_north_0+velocity_up_0+speed_accuracy_0) | |
sample_0 = (header+sample_0_no_head) | |
# sample 2 | |
time_gps_epoch_1 = struct.pack('<d', 1553343930200.0) | |
gps_fix_type_1 = struct.pack('<i', 3) | |
latitude_1 = struct.pack('<d', 51.26007777777778) | |
longitude_1 = struct.pack('<d', -0.9531694444444444) | |
altitude_1 = struct.pack('<f', 126.2) | |
horizontal_accuracy_1 = struct.pack('<f', 1.0) | |
vertical_accuracy_1 = struct.pack('<f', 1.0) | |
velocity_east_1 = struct.pack('<f', -0.2960776004545653) | |
velocity_north_1 = struct.pack('<f', 0.18875339246390743) | |
velocity_up_1 = struct.pack('<f', 0.0) | |
speed_accuracy_1 = struct.pack('<f', 0.0) | |
sample_1 = (header+time_gps_epoch_1+gps_fix_type_1+latitude_1+ | |
longitude_1+altitude_1+horizontal_accuracy_1+vertical_accuracy_1+ | |
velocity_east_1+velocity_north_1+velocity_up_1+speed_accuracy_1) | |
# sample 2 | |
time_gps_epoch_2 = struct.pack('<d', 1553343930400.0) | |
gps_fix_type_2 = struct.pack('<i', 3) | |
latitude_2 = struct.pack('<d', 51.26009444444445) | |
longitude_2 = struct.pack('<d', -0.9532111111111111) | |
altitude_2 = struct.pack('<f', 124.3) | |
horizontal_accuracy_2 = struct.pack('<f', 1.0) | |
vertical_accuracy_2 = struct.pack('<f', 1.0) | |
velocity_east_2 = struct.pack('<f', -0.30465075085200577) | |
velocity_north_2 = struct.pack('<f', 0.1477752379350783) | |
velocity_up_2 = struct.pack('<f', 0.0) | |
speed_accuracy_2 = struct.pack('<f', 0.0) | |
sample_2 = (header+time_gps_epoch_2+gps_fix_type_2+latitude_2+ | |
longitude_2+altitude_2+horizontal_accuracy_2+vertical_accuracy_2+ | |
velocity_east_2+velocity_north_2+velocity_up_2+speed_accuracy_2) | |
# sample 3 | |
time_gps_epoch_3 = struct.pack('<d', 1553343930600.0) | |
gps_fix_type_3 = struct.pack('<i', 3) | |
latitude_3 = struct.pack('<d', 51.26011388888889) | |
longitude_3 = struct.pack('<d', -0.953275) | |
altitude_3 = struct.pack('<f', 122.6) | |
horizontal_accuracy_3 = struct.pack('<f', 1.0) | |
vertical_accuracy_3 = struct.pack('<f', 1.0) | |
velocity_east_3 = struct.pack('<f', -0.20935273424251769) | |
velocity_north_3 = struct.pack('<f', 0.11122101212837258) | |
velocity_up_3 = struct.pack('<f', 0.0) | |
speed_accuracy_3 = struct.pack('<f', 0.0) | |
sample_3 = (header+time_gps_epoch_3+gps_fix_type_3+latitude_3+ | |
longitude_3+altitude_3+horizontal_accuracy_3+vertical_accuracy_3+ | |
velocity_east_3+velocity_north_3+velocity_up_3+speed_accuracy_3) | |
# sample 4 | |
time_gps_epoch_4 = struct.pack('<d', 1553343930800.0) | |
gps_fix_type_4 = struct.pack('<i', 3) | |
latitude_4 = struct.pack('<d', 51.260133333333336) | |
longitude_4 = struct.pack('<d', -0.9533333333333333) | |
altitude_4 = struct.pack('<f', 120.8) | |
horizontal_accuracy_4 = struct.pack('<f', 1.0) | |
vertical_accuracy_4 = struct.pack('<f', 1.0) | |
velocity_east_4 = struct.pack('<f', -0.1918253910417178) | |
velocity_north_4 = struct.pack('<f', 0.11464815023472924) | |
velocity_up_4 = struct.pack('<f', 0.0) | |
speed_accuracy_4 = struct.pack('<f', 0.0) | |
sample_4 = (header+time_gps_epoch_4+gps_fix_type_4+latitude_4+ | |
longitude_4+altitude_4+horizontal_accuracy_4+vertical_accuracy_4+ | |
velocity_east_4+velocity_north_4+velocity_up_4+speed_accuracy_4) | |
# sample 5 | |
time_gps_epoch_5 = struct.pack('<d', 1553343931000.0) | |
gps_fix_type_5 = struct.pack('<i', 3) | |
latitude_5 = struct.pack('<d', 51.26015833333334) | |
longitude_5 = struct.pack('<d', -0.9533999999999999) | |
altitude_5 = struct.pack('<f', 120.1) | |
horizontal_accuracy_5 = struct.pack('<f', 1.0) | |
vertical_accuracy_5 = struct.pack('<f', 1.0) | |
velocity_east_5 = struct.pack('<f', -0.18010009841425276) | |
velocity_north_5 = struct.pack('<f', 0.11694262588071799) | |
velocity_up_5 = struct.pack('<f', 0.0) | |
speed_accuracy_5 = struct.pack('<f', 0.0) | |
sample_5 = (header+time_gps_epoch_5+gps_fix_type_5+latitude_5+ | |
longitude_5+altitude_5+horizontal_accuracy_5+vertical_accuracy_5+ | |
velocity_east_5+velocity_north_5+velocity_up_5+speed_accuracy_5) | |
# final telemetry to inject | |
all_samples = (sample_0+sample_1+sample_2+sample_3+sample_4+sample_5) | |
# print the samples | |
print("Sample 0 no header") | |
print(sample_0_no_head) | |
print("Sample 0") | |
print(sample_0) | |
print("Sample 1") | |
print(sample_1) | |
print("Sample 2") | |
print(sample_1) | |
print("Sample 3") | |
print(sample_2) | |
print("Sample 4") | |
print(sample_3) | |
print("Sample 5") | |
print(sample_4) | |
print("All samples") | |
print(all_samples) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment