4
4
"""
5
5
6
6
import argparse
7
- from pathlib import Path
8
7
9
8
10
9
from pymavlink import mavutil
11
10
from modules .common .modules .data_encoding import message_encoding_decoding
12
11
from modules .common .modules .data_encoding import metadata_encoding_decoding
13
12
from modules .common .modules .data_encoding import worker_enum
14
- import modules .common .modules .kml . kml_conversion
13
+ import modules .common .modules .kml
15
14
16
15
17
16
CONNECTION_ADDRESS = "tcp:localhost:14550"
@@ -32,9 +31,6 @@ def main(save_directory: str, document_name_prefix: str) -> int:
32
31
Returns:
33
32
int: 0 on success, -1 on error (connection failure, invalid data, or failure to save KML).
34
33
"""
35
- save_directory = Path (args .save_directory )
36
- document_name_prefix = args .document_name_prefix
37
-
38
34
vehicle = mavutil .mavlink_connection (CONNECTION_ADDRESS , source_system = 255 , source_component = 0 )
39
35
# Catch library and other unexpected errors
40
36
# pylint: disable=broad-exception-caught
@@ -83,7 +79,7 @@ def main(save_directory: str, document_name_prefix: str) -> int:
83
79
)
84
80
positions .append (global_position )
85
81
received_positions_count += 1
86
- success , kml_path = kml_conversion .positions_to_kml (
82
+ success , kml_path = modules . common . modules . kml . kml_conversion .positions_to_kml (
87
83
positions , document_name_prefix , save_directory
88
84
)
89
85
if not success :
@@ -95,6 +91,7 @@ def main(save_directory: str, document_name_prefix: str) -> int:
95
91
96
92
DEFAULT_SAVE_DIRECTORY = "logs"
97
93
DEFAULT_DOCUMENT_NAME_PREFIX = "IR hotspot locations"
94
+
98
95
if __name__ == "__main__" :
99
96
parser = argparse .ArgumentParser (description = "Collect drone GPS positions and save as KML." )
100
97
parser .add_argument (
@@ -110,4 +107,5 @@ def main(save_directory: str, document_name_prefix: str) -> int:
110
107
help = "Prefix for the KML document name." ,
111
108
)
112
109
args = parser .parse_args ()
113
- main (save_directory , document_name_prefix )
110
+
111
+ main (args .save_directory , args .document_name_prefix )
0 commit comments